AsynqFramework.CodeWriter.CodeWriterBase.WriteValue C# (CSharp) Method

WriteValue() public method

Writes a C# constant value to the output.
public WriteValue ( Type vType, object value ) : void
vType System.Type
value object
return void
        public virtual void WriteValue(Type vType, object value)
        {
            if (vType.IsPrimitive)
            {
                if (vType == typeof(int)) WritePrimitive((int)value);
                else if (vType == typeof(bool))
                {
                    if ((bool)value == true) WriteKeyword("true");
                    else WriteKeyword("false");
                }
                else if (vType == typeof(decimal)) WritePrimitive((decimal)value);
                else if (vType == typeof(char)) WritePrimitive((char)value);
                else if (vType == typeof(sbyte)) WritePrimitive((sbyte)value);
                else if (vType == typeof(byte)) WritePrimitive((byte)value);
                else if (vType == typeof(short)) WritePrimitive((short)value);
                else if (vType == typeof(ushort)) WritePrimitive((ushort)value);
                else if (vType == typeof(uint)) WritePrimitive((uint)value);
                else if (vType == typeof(long)) WritePrimitive((long)value);
                else if (vType == typeof(ulong)) WritePrimitive((ulong)value);
                else if (vType == typeof(double)) WritePrimitive((double)value);
                else if (vType == typeof(float)) WritePrimitive((float)value);
                else
                {
                    WriteComment(String.Format("/* Unknown primitive type {0} */", vType.FullName));
                }
            }
            else if (vType == typeof(string))
            {
                WritePrimitive((string)value);
            }
            else
            {
                // TODO: other constant types for display here!
                Output(value.ToString(), TokenType.Unformatted, (object)value);
            }
        }