System.RuntimeCustomAttributeData.CreateTypedArgumentStruct C# (CSharp) Method

CreateTypedArgumentStruct() public method

public CreateTypedArgumentStruct ( Type type, object value ) : CustomAttributeTypedArgument
type Type
value object
return System.Reflection.CustomAttributeTypedArgument
        public CustomAttributeTypedArgument CreateTypedArgumentStruct(Type type, object value)
        {
            // Because C# doesn't like structs which contain object references to be referenced by pointers
            // we need to use a special MOSA compiler trick to get its address to create a pointer
            CustomAttributeTypedArgument typedArgument = new CustomAttributeTypedArgument();
            var ptr = (uint**)Intrinsic.GetValueTypeAddress(typedArgument);
            ptr[0] = (uint*)Intrinsic.GetObjectAddress(type);
            ptr[1] = (uint*)Intrinsic.GetObjectAddress(value);

            return typedArgument;
        }