// 集合返回字符串
public static string ReturnString(List<string> content)
{
string strArray = string.Join(",", content.ToArray());
return strArray;
}
//字符串转换成int数组
public static int[] ReturnIntArr(string content)
{
int[] list;
if (content == "" || content == null)
{
list = new[] { -1 };
}
else
{
list = Array.ConvertAll<string, int>(content.Split(','), s => int.Parse(s));
}
return list;
}
//字符串是否包含在枚举中
Enum.IsDefined(typeof(枚举), "字符串")
//根据值 获得枚举名字
string name = Enum.GetName(typeof(枚举), index)
//根据名字实例化对象
类= ("类名")Assembly.GetExecutingAssembly().CreateInstance("命名空间." + "类名");
//根据名字调用方法
this.GetType().GetMethod("方法名").Invoke(this, null);
网友评论