示例#1
0
 /// <summary>
 /// 把对象可读属性读出来变成字典
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public static Dictionary <string, string> ObjectToStringDict(object data)
 {
     return(ObjectToDict_(data).ToDictionary(x => x.Key, x => ConvertHelper.GetString(x.Value)));
 }
示例#2
0
 /// <summary>
 /// 第一个非空字符串
 /// </summary>
 /// <param name="strs"></param>
 /// <returns></returns>
 public static string FirstPlumpStrOrNot(params string[] strs) =>
 ConvertHelper.NotNullList(strs).Where(x => ValidateHelper.IsPlumpString(x)).FirstOrDefault();
示例#3
0
 /// <summary>
 /// 获取字符前几位,并加省略号
 /// </summary>
 /// <param name="str"></param>
 /// <param name="len"></param>
 /// <returns></returns>
 public static string GetPreviewString(string str, int len)
 {
     str = ConvertHelper.GetString(str);
     return((str.Length <= len) ? str : str.Substring(0, len) + "...");
 }
示例#4
0
 /// <summary>
 /// 包含长度大于0的item,并把他们找出来
 /// </summary>
 public static bool IsPlumpListAfterFilterMeaninglessData(IEnumerable <string> list, out List <string> filtered)
 {
     filtered = ConvertHelper.NotNullList(list).Where(x => IsPlumpString(x)).ToList();
     return(filtered.Count > 0);
 }