private List <ProtoToCSItem> GetItems(Dictionary <string, string> inDic) { string lastValueName = ""; // 上一属性的属性名 List <ProtoToCSItem> backList = new List <ProtoToCSItem>(); foreach (KeyValuePair <string, string> item in inDic) { bool isSelfDefine = false; // 是否为自定义类型 bool isArray = item.Value.Contains("[]"); // 是否为数组 Type t = Stringer.GetFieldType(item.Value, ref isSelfDefine); // 属性类型 ProtoToCSItem i = new ProtoToCSItem(item.Key, t); i.IsSelfDefine = isSelfDefine; i.IsArray = isArray; i.ArrayLengthName = isArray ? lastValueName : ""; backList.Add(i); lastValueName = item.Key; } return(backList); }