鉴于下面的类,将多个字符串添加到名为blob_key_col_name的StringCollection中的正确方法是什么?
public class blob_info
{
public string column_name { get; set; }
public string blob_value { get; set; }
public int column_pos { get; set; }
public string blob_key { get; set; }
public int blob_key_count { get; set; }
public StringCollection blob_key_col_name { get; set; }
public blob_info(string column_name, string blob_value, int column_pos, string blob_key, int blob_key_count)
{
this.column_name = column_name;
this.blob_value = blob_value;
this.column_pos = column_pos;
this.blob_key = blob_key;
this.blob_key_count = blob_key_count;
blob_key_col_name = new StringCollection();
}
}
public static List<blob_info> blob_col = new List<blob_info>();
void main
{
blob_col.Add(new blob_info("Column_name","pathname",0,"key_column_name",0,blob_key_col_name.Add("")));
}
答案 0 :(得分:1)
那将是使用:
from operator import itemgetter
a = [[1, 3, 5], [2, 511, 7], [17, 233, 1]]
a = sorted(a, key=itemgetter(1))
查看文档以获取更多详细信息。 https://msdn.microsoft.com/en-us/library/system.collections.specialized.stringcollection(v=vs.110).aspx