MichBman
asked on
I have a switch statement to compare a datagrid column type to a constant. How do I assign a DateTime type to a constant. I tried using type of but that is run time
Please see attached code. Â Constant declaration is not right because it is at runtime.
public const string cstrDateTime = typeof(System.DateTime).ToString();
switch (ColomnType)
{
case cstrInt:
// Output Integers as numbers
msoStyle = "";
break;
case cstrDateTime:
// Output dates as MM/dd/yyyy
msoStyle = "mso-number-format: mm\\/dd\\/yy";
break;
default:
// Output other values as string
msoStyle = "mso-number-format: \\@";
break;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.