示例#1
0
 /// <summary>
 /// 添加群信息
 /// </summary>
 /// <param name="value">群信息</param>
 /// <returns>true: 添加成功; false: 覆盖成功</returns>
 public static bool AddGroupChat(GroupChat value)
 {
     if (value == null)
     {
         throw new ArgumentNullException();
     }
     for (var i = 0; i < GroupList.Count; ++i)
     {
         if (GroupList[i].ID.Ticks == value.ID.Ticks)
         {
             foreach (var prop in value.GetType().GetProperties())
             {
                 if (prop.CanWrite)
                 {
                     var data = prop.GetValue(value);
                     if (data != null)
                     {
                         prop.SetValue(GroupList[i], data);
                     }
                 }
             }
             return(false);
         }
     }
     GroupList.Add(value);
     return(true);
 }