Here are the examples of the csharp api System.Reflection.Emit.ILGenerator.EmitString(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
19
Source : EmitExtensions.cs
with MIT License
from fs7744
with MIT License
from fs7744
private static bool TryEmitILConstant(this ILGenerator il, object value, Type type)
{
switch (Type.GetTypeCode(type))
{
case TypeCode.Boolean:
il.EmitBoolean((bool)value);
return true;
case TypeCode.SByte:
il.EmitSByte((sbyte)value);
return true;
case TypeCode.Int16:
il.EmitShort((short)value);
return true;
case TypeCode.Int32:
il.EmitInt((int)value);
return true;
case TypeCode.Int64:
il.EmitLong((long)value);
return true;
case TypeCode.Single:
il.EmitSingle((float)value);
return true;
case TypeCode.Double:
il.EmitDouble((double)value);
return true;
case TypeCode.Char:
il.EmitChar((char)value);
return true;
case TypeCode.Byte:
il.EmitByte((byte)value);
return true;
case TypeCode.UInt16:
il.EmitUShort((ushort)value);
return true;
case TypeCode.UInt32:
il.EmitUInt((uint)value);
return true;
case TypeCode.UInt64:
il.EmitULong((ulong)value);
return true;
case TypeCode.Decimal:
il.EmitDecimal((decimal)value);
return true;
case TypeCode.String:
il.EmitString((string)value);
return true;
default:
return false;
}
}