本文整理汇总了C#中java.lang.Class.isArray方法的典型用法代码示例。如果您正苦于以下问题:C# Class.isArray方法的具体用法?C# Class.isArray怎么用?C# Class.isArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.lang.Class
的用法示例。
在下文中一共展示了Class.isArray方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: JavaSignature
internal static string JavaSignature(Class clazz)
{
string name = clazz.FullName;
if (clazz.isPrimitive())
{
switch (name)
{
case "boolean":
return "Z";
case "int":
return "I";
case "double":
return "D";
case "float":
return "F";
case "short":
return "S";
case "long":
return "J";
case "char":
return "C";
case "byte":
return "B";
case "void":
return "V";
default:
throw new NotImplementedException();
}
}
if (clazz.isArray())
{
return name.Replace('.', '/');
}
return "L" + name.Replace('.', '/') + ";";
}
示例2: RegisterClass
internal static GType RegisterClass(Class clazz, TypeRegistration registration)
{
if (knownClasses.ContainsKey(clazz))
{
GType known = knownClasses[clazz];
if (registration != null)
{
known.Registration = registration;
}
return known;
}
var res = new GType();
if (clazz.isArray())
{
res.ArrayElement = RegisterClass(clazz.getComponentType(), null);
res.IsArray = true;
string array = "[]";
Class comp = clazz.getComponentType();
while (comp.isArray())
{
array += "[]";
comp = comp.getComponentType();
}
res.LowerName = ((string) comp.getName()).ToLowerInvariant() + array;
}
else
{
res.LowerName = ((string) clazz.getName()).ToLowerInvariant();
}
res.Attributes = 0;
var classModifiers = (ModifierFlags) clazz.getModifiers();
if ((classModifiers & ModifierFlags.Abstract) != 0)
{
res.IsAbstract = true;
res.Attributes |= TypeAttributes.Abstract;
}
if ((classModifiers & ModifierFlags.Final) != 0)
{
res.IsFinal = true;
}
if ((classModifiers & ModifierFlags.Public) != 0)
{
res.Attributes |= TypeAttributes.Public;
}
else if ((classModifiers & ModifierFlags.Private) != 0)
{
res.Attributes |= TypeAttributes.NotPublic;
}
//TODO internal ?
if (knownNames.ContainsKey(res.LowerName))
{
res = knownNames[res.LowerName];
}
if (res.Registration == null && registration != null)
{
res.Registration = registration;
}
res.JVMType = clazz;
res.JVMFullName = clazz.getName();
if (res.IsArray)
{
string array = "[]";
Class comp = clazz.getComponentType();
while (comp.isArray())
{
array += "[]";
comp = comp.getComponentType();
}
res.JVMFullName = comp.getName() + array;
}
else
{
res.JVMFullName = clazz.getName();
}
res.IsJVMType = true;
res.IsPrimitive = clazz.isPrimitive();
res.IsException = Throwable._class.isAssignableFrom(clazz);
res.IsInterface = clazz.isInterface();
res.IsCLRProxy = clrProxyClass != null && clrProxyClass.isAssignableFrom(clazz);
if (!res.IsCLRProxy)
{
res.IsJVMRealType = true;
}
Class superclass = clazz.getSuperclass();
var isBaseClassPublic = superclass == null || ((ModifierFlags)superclass.getModifiers() & ModifierFlags.Public) != 0;
if (superclass != null && res.Base == null
&& clazz != Object._class
&& clazz != Throwable._class
&& res.JVMFullName != "system.Object"
&& res.JVMFullName != "system.Exception"
&& isBaseClassPublic)
{
res.Base = RegisterClass(superclass);
}
List<Class> interfaces = new List<Class>(clazz.getInterfaces());
if (!isBaseClassPublic)
{
interfaces.AddRange(superclass.getInterfaces());
res.Base = RegisterClass(superclass.getSuperclass());
//.........这里部分代码省略.........
示例3: getSignature
public static string getSignature(Class type)
{
if (type == Byte.TYPE)
return "B";
if (type == Short.TYPE)
return "S";
if (type == Integer.TYPE)
return "I";
if (type == Long.TYPE)
return "J";
if (type == Float.TYPE)
return "F";
if (type == Double.TYPE)
return "D";
if (type == Boolean.TYPE)
return "Z";
if (type == Character.TYPE)
return "C";
if (type == Void.TYPE)
return "V";
if (type.isArray())
{
string name = type.getName();
string str = ".";
object obj1 = (object) "/";
object obj2 = (object) str;
CharSequence charSequence1;
charSequence1.__\u003Cref\u003E = (__Null) obj2;
CharSequence charSequence2 = charSequence1;
object obj3 = obj1;
charSequence1.__\u003Cref\u003E = (__Null) obj3;
CharSequence charSequence3 = charSequence1;
return String.instancehelper_replace(name, charSequence2, charSequence3);
}
else
{
StringBuilder stringBuilder = new StringBuilder().append("L");
string name = type.getName();
string str1 = ".";
object obj1 = (object) "/";
object obj2 = (object) str1;
CharSequence charSequence1;
charSequence1.__\u003Cref\u003E = (__Null) obj2;
CharSequence charSequence2 = charSequence1;
object obj3 = obj1;
charSequence1.__\u003Cref\u003E = (__Null) obj3;
CharSequence charSequence3 = charSequence1;
string str2 = String.instancehelper_replace(name, charSequence2, charSequence3);
return stringBuilder.append(str2).append(";").toString();
}
}
示例4: canAcceptArrayType
public virtual bool canAcceptArrayType(Class type)
{
return type.isArray() && this.canAcceptType(type.getComponentType());
}