Link to home
Start Free TrialLog in
Avatar of MichBman
MichBmanFlag for United States of America

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;
                        }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of thepanch
thepanch

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial