TypeReference.Write C# (CSharp) Method

Write() public method

public Write ( StringBuilder text, SignatureType, type, GlobalInfo, info ) : void
text StringBuilder
type SignatureType,
info GlobalInfo,
return void
	public void Write (StringBuilder text, SignatureType type, GlobalInfo info)
	{
		if (IsConst && (type == SignatureType.Native || type == SignatureType.NativeC))
			text.Append ("const ");

		if (type != SignatureType.Native && type != SignatureType.NativeC) {
			if (IsRef && !IsReturnType)
				text.Append ("ref ");
			if (IsOut && !IsReturnType)
				text.Append ("out ");
		}

		if (type == SignatureType.NativeC && info.IsEnum (Value)) {
			text.Append (GetPrettyType ().Replace (Value.Replace ("*", ""), "int"));
		} else if (type == SignatureType.Native || type == SignatureType.NativeC) {
			text.Append (GetPrettyType ());
		} else {
			text.Append (GetManagedType ());
		}
	}

Usage Example

Ejemplo n.º 1
0
    public void WriteSignature(StringBuilder text, SignatureType type)
    {
        if (type == SignatureType.PInvoke)
        {
            if ((ParameterType.Value == "bool") || (ParameterType.Value == "bool*"))
            {
                text.Append("[MarshalAs (UnmanagedType.U1)] ");
            }
            if (Annotations.ContainsKey("IsOut"))
            {
                text.Append("out ");
            }
            if (Annotations.ContainsKey("IsRef"))
            {
                text.Append("ref ");
            }
        }

        if (type == SignatureType.PInvoke && Annotations.ContainsKey("MarshalAs"))
        {
            text.Append(Annotations ["MarshalAs"].Value);
        }
        else if (type == SignatureType.NativeC && ParameterType.Value == "GCHandle")
        {
            text.Append("void *");
        }
        else
        {
            ParameterType.Write(text, type, GlobalInfo);
        }
        if ((type != SignatureType.Native && type != SignatureType.NativeC) || !ParameterType.IsPointer)
        {
            text.Append(" ");
        }
        text.Append(Name);
    }
All Usage Examples Of TypeReference::Write