C#判断属性是否是静态

 1      /// <summary>
 2         /// 检查是否是静态成员
 3         /// </summary>
 4         /// <returns></returns>
 5         protected bool CheckStatic(PropertyInfo propertyInfo)
 6         {
 7             var getMethod = propertyInfo.GetMethod;
 8             if (getMethod != null)
 9             {
10                 return getMethod.IsStatic;
11             }
12             else
13             {
14                 var setMethod = propertyInfo.SetMethod;
15                 return setMethod.IsStatic;
16             }
17         }

猜你喜欢

转载自www.cnblogs.com/kent-apple/p/10208153.html