UnsafeAccessorTypeAttribute(String) Constructor
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Instantiates an UnsafeAccessorTypeAttribute providing access to a type supplied by typeName.
public:
UnsafeAccessorTypeAttribute(System::String ^ typeName);
public UnsafeAccessorTypeAttribute(string typeName);
new System.Runtime.CompilerServices.UnsafeAccessorTypeAttribute : string -> System.Runtime.CompilerServices.UnsafeAccessorTypeAttribute
Public Sub New (typeName As String)
Parameters
- typeName
- String
A fully qualified or partially qualified type name.
Remarks
typeName is expected to follow the same rules as if it were being passed to <see name="Type.GetType(String)"></see>. When unbound generics are involved they should follow the IL syntax of referencing a type or method generic variables using the syntax of !N or !!N respectively, where N is the zero-based index of the generic parameters. The generic rules defined for UnsafeAccessorAttribute apply to this attribute as well, meaning the arity and type of generic parameter must match the target type.
This attribute only has behavior on parameters or return values of methods marked with UnsafeAccessorAttribute.
This attribute should only be applied to parameters or return types of methods that are typed as follows:
- References should be typed as
object. - Byref arguments should be typed with
in,ref, orouttoobject. - Unmanaged pointers should be typed as
void*. - Byref arguments to reference types or arrays should be typed with
in,ref, orouttoobject. - Byref arguments to unmanaged pointer types should be typed with
in,ref, orouttovoid*.
Due to lack of variance for byrefs, returns involving byrefs are not supported. This specifically means that accessors for fields of inaccessible types are not supported.