我這是越來越充滿正確的,但之後其填充我想刪除所有的按鍵與一個簡單的方法爲空值,如果存在一個列表,像:從列表中刪除空值<classname>
posts.RemoveAll(item => item == null);
我在這個列表中有多個職位<> 對於我來說,問題是要找到鍵/值來訪問字典。
有人知道如何做到這一點嗎?
UPDATE:
我的課是這樣的:
public class iPost
{
public int id { get; set; }
public int post_origin_post_id { get; set; }
public int pid { get; set; }
public int container_type_id { get; set; }
public int post_member_id { get; set; }
public int post_toGroup_id { get; set; }
public string title { get; set; }
public string comment { get; set; }
public string latitude { get; set; }
public string longitude { get; set; }
public string post_ip { get; set; }
public bool canShared { get; set; }
public bool isShared { get; set; }
public int share_type_id { get; set; }
public int views { get; set; }
''我有一個List ...我想刪除所有具有空值的鍵「'。 '列表'沒有鍵/值,只有'T's。如果你需要任何有用的幫助,你將需要展示一些示例代碼(一個最小的工作示例)。 ['List .RemoveAll'](http://msdn.microsoft.com/zh-cn/library/wdka673a.aspx)接受一個謂詞,您可以根據需要選擇要刪除的對象。 –
2014-10-22 03:26:06
這聽起來像你想'posts.RemoveAll(item => item.key == null);'?但是你需要顯示你的classname類。 – 2014-10-22 03:28:59
http://stackoverflow.com/questions/1636885/remove-item-in-dictionary-based-on-value – 2014-10-22 05:47:25