protected virtual void GeneratePrimitiveExpression(CodePrimitiveExpression e)
{
if (e.Value == null)
{
Output.Write(NullToken);
}
else if (e.Value is string)
{
Output.Write(QuoteSnippetString((string)e.Value));
}
else if (e.Value is char)
{
Output.Write("'" + e.Value.ToString() + "'");
}
else if (e.Value is byte)
{
Output.Write(((byte)e.Value).ToString(CultureInfo.InvariantCulture));
}
else if (e.Value is short)
{
Output.Write(((short)e.Value).ToString(CultureInfo.InvariantCulture));
}
else if (e.Value is int)
{
Output.Write(((int)e.Value).ToString(CultureInfo.InvariantCulture));
}
else if (e.Value is long)
{
Output.Write(((long)e.Value).ToString(CultureInfo.InvariantCulture));
}
else if (e.Value is float)
{
GenerateSingleFloatValue((float)e.Value);
}
else if (e.Value is double)
{
GenerateDoubleValue((double)e.Value);
}
else if (e.Value is decimal)
{
GenerateDecimalValue((decimal)e.Value);
}
else if (e.Value is bool)
{
if ((bool)e.Value)
{
Output.Write("true");
}
else
{
Output.Write("false");
}
}
else
{
throw new ArgumentException(SR.Format(SR.InvalidPrimitiveType, e.Value.GetType().ToString()));
}
}