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


C# Class.getSimpleName方法代码示例

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


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

示例1: getLibraryName

 public static string getLibraryName(Class cls)
 {
   return new StringBuilder().append("jni").append(cls.getSimpleName()).toString();
 }
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:4,代码来源:Loader.cs

示例2: buildRunner

    public virtual Runner buildRunner(Class runnerClass, Class testClass)
    {
      Runner runner1;
      try
      {
        Class class1 = runnerClass;
        Class[] classArray = new Class[1];
        int index1 = 0;
        // ISSUE: variable of the null type
        __Null local = ClassLiteral<Class>.Value;
        classArray[index1] = (Class) local;
        CallerID callerId1 = AnnotatedBuilder.__\u003CGetCallerID\u003E();
        Constructor constructor = class1.getConstructor(classArray, callerId1);
        object[] objArray = new object[1];
        int index2 = 0;
        Class class2 = testClass;
        objArray[index2] = (object) class2;
        CallerID callerId2 = AnnotatedBuilder.__\u003CGetCallerID\u003E();
        runner1 = (Runner) constructor.newInstance(objArray, callerId2);
      }
      catch (NoSuchMethodException ex)
      {
        goto label_3;
      }
      return runner1;
label_3:
      Runner runner2;
      try
      {
        Class class1 = runnerClass;
        Class[] classArray = new Class[2];
        int index1 = 0;
        // ISSUE: variable of the null type
        __Null local1 = ClassLiteral<Class>.Value;
        classArray[index1] = (Class) local1;
        int index2 = 1;
        // ISSUE: variable of the null type
        __Null local2 = ClassLiteral<RunnerBuilder>.Value;
        classArray[index2] = (Class) local2;
        CallerID callerId1 = AnnotatedBuilder.__\u003CGetCallerID\u003E();
        Constructor constructor = class1.getConstructor(classArray, callerId1);
        object[] objArray = new object[2];
        int index3 = 0;
        Class class2 = testClass;
        objArray[index3] = (object) class2;
        int index4 = 1;
        RunnerBuilder runnerBuilder = this.fSuiteBuilder;
        objArray[index4] = (object) runnerBuilder;
        CallerID callerId2 = AnnotatedBuilder.__\u003CGetCallerID\u003E();
        runner2 = (Runner) constructor.newInstance(objArray, callerId2);
      }
      catch (NoSuchMethodException ex)
      {
        goto label_7;
      }
      return runner2;
label_7:
      string simpleName = runnerClass.getSimpleName();
      string str1 = "Custom runner class %s should have a public constructor with signature %s(Class testClass)";
      object[] objArray1 = new object[2];
      int index5 = 0;
      string str2 = simpleName;
      objArray1[index5] = (object) str2;
      int index6 = 1;
      string str3 = simpleName;
      objArray1[index6] = (object) str3;
      string @string = String.format(str1, objArray1);
      Throwable.__\u003CsuppressFillInStackTrace\u003E();
      throw new InitializationError(@string);
    }
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:70,代码来源:AnnotatedBuilder.cs

示例3: getName

    public static string getName(Class clazz)
    {
      string str1;
      try
      {
        Field declaredField = clazz.getDeclaredField("NAME", DisplayElement.__\u003CGetCallerID\u003E());
        int modifiers = declaredField.getModifiers();
        if (!Modifier.isStatic(modifiers))
        {
          string str2 = "TYPES must be static";
          Throwable.__\u003CsuppressFillInStackTrace\u003E();
          throw new RuntimeException(str2);
        }
        else if (!Modifier.isFinal(modifiers))
        {
          string str2 = "TYPES must be final";
          Throwable.__\u003CsuppressFillInStackTrace\u003E();
          throw new RuntimeException(str2);
        }
        else if (Modifier.isStatic(modifiers))
        {
          if (Modifier.isFinal(modifiers))
            str1 = (string) declaredField.get((object) null, DisplayElement.__\u003CGetCallerID\u003E());
          else
            goto label_11;
        }
        else
          goto label_11;
      }
      catch (Exception ex)
      {
        int num = 2;
        if (ByteCodeHelper.MapException<Exception>(ex, (ByteCodeHelper.MapFlags) num) == null)
          throw;
        else
          goto label_10;
      }
      return str1;
label_10:
label_11:
      return clazz.getSimpleName();
    }
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:42,代码来源:DisplayElement.cs


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