首页 > 代码库 > 属性代码生成器

属性代码生成器

废话不多说,好用你告诉我,不好用你告诉大家,有什么需要改进的可以优化!

核心代码如下:

string str = item.Replace(",", ",");
string[] strArr = str.Split(‘,‘);
if (strArr != null && strArr.Length > 0)
{
fieldS = strArr[0];
fieldB = fieldS.Replace(StringTypeHelper.StartWith, "");
stringType = strArr[1];
annotation = strArr[2];
resultSB.Append("private " + stringType + empty + fieldS + ";" + newlineSymbol
+ "/// <summary>" + newlineSymbol
+ "///" + annotation + newlineSymbol
+ "/// </summary>" + newlineSymbol
+ "public " + stringType + empty + fieldB + newlineSymbol
+ "{" + newlineSymbol
+ "get { return " + fieldS + "; }" + newlineSymbol
+ "set {" + fieldS + " = value; }" + newlineSymbol
+ "}" + isEnd + isEnd
);
}

属性代码生成器下载