当前位置: 首页>>代码示例>>C#>>正文


C# Class.getModifiers方法代码示例

本文整理汇总了C#中Class.getModifiers方法的典型用法代码示例。如果您正苦于以下问题:C# Class.getModifiers方法的具体用法?C# Class.getModifiers怎么用?C# Class.getModifiers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Class的用法示例。


在下文中一共展示了Class.getModifiers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsInstantiable

 /// <summary>
 /// This is used to determine if the class is an inner class. If
 /// the class is a inner class and not static then this returns
 /// false. Only static inner classes can be instantiated using
 /// reflection as they do not require a "this" argument.
 /// </summary>
 /// <param name="type">
 /// this is the class that is to be evaluated
 /// </param>
 /// <returns>
 /// this returns true if the class is a static inner
 /// </returns>
 public bool IsInstantiable(Class type) {
    int modifiers = type.getModifiers();
    if(Modifier.isStatic(modifiers)) {
       return true;
    }
    return !type.isMemberClass();
 }
开发者ID:ngallagher,项目名称:simplexml,代码行数:19,代码来源:ConstructorScanner.cs

示例2: IsInstantiable

 /// <summary>
 /// This is used to determine whether the type given is instantiable,
 /// that is, this determines if an instance of that type can be
 /// created. If the type is an interface or an abstract class then
 /// this will return false.
 /// </summary>
 /// <param name="type">
 /// this is the type to check the modifiers of
 /// </param>
 /// <returns>
 /// false if the type is an interface or an abstract class
 /// </returns>
 public bool IsInstantiable(Class type) {
    int modifiers = type.getModifiers();
    if(Modifier.isAbstract(modifiers)) {
       return false;
    }
    return !Modifier.isInterface(modifiers);
 }
开发者ID:ngallagher,项目名称:simplexml,代码行数:19,代码来源:Factory.cs


注:本文中的Class.getModifiers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。