Class 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
Objective-C 类的托管表示形式。
public class Class : ObjCRuntime.INativeObjecttype Class = class
    interface INativeObject- 继承
- 
				Class
- 实现
注解
可以使用系列 Handle 方法将按名称的类型或将 NSObject 子类化为类实例的 .NET 类型。
// 
// If you know that the type subclasses NSObject, 
// you can just call new Class (Type):
//
Class GetClassForType (Type type)
{
	return new Class (type);
}
以下示例演示如何使用本机句柄来检查类型子类是否为 NSObject,从而从 Type 实例获取 Objective-C 类是否有效:
//
// Using low-level handles, allows for error checking in case the 
// type does not subclass NSObject:
//
Class GetClassForType (Type type)
{
    Type typeToLookup = typeof (type);
    IntPtr myClassHandle = Class.GetHandle (typeToLookup);
    if (myClassHandle != IntPtr.Zero)
        return new Class (myClassHandle);
    else
        return null;
}
构造函数
| Class(IntPtr, Boolean) | 从非托管句柄创建实例。 | 
| Class(IntPtr) | 从非托管句柄创建实例。 | 
| Class(String) | 根据名称创建类。 | 
| Class(Type) | 从指定的类型创建类。 | 
字段
| ThrowOnInitFailure | 确定如果成功创建了相应的本机对象,则 Xamarin.iOS 是否会签入 NSObject 构造函数, (默认值为 true) 。 | 
属性
| Handle | 处理指向非托管对象表示形式的 (指针) 。 | 
| Name | 此类的 Objective-C 名称。 | 
| SuperClass | 此类超类的 Objective-C 句柄。 | 
方法
| GetHandle(String) | 返回 Objective-C 类的非托管句柄。 | 
| GetHandle(Type) | 获取给定类型的 Objective-C 句柄。 | 
| GetHandleIntrinsic(String) | 获取给定类型的 Objective-C 句柄。 | 
| Lookup(Class) | 此方法查找给定 Objective-C 类的托管类型。 |