Comparaison de Type d'un string
bonjour,
je voudrais récupérer le type d'un string et faire une comparaison,
mais j'ai une erreur
voici mon code:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
//String Mystring = "1234";
string Mystring = "blabla";
Type type = MyString.GetType();
if (type == System.String)
{
//instructions
}
if (type == System.Int32)
{
//instructions
} |
voici l'erreur:
Citation:
String is a type which is not valid in the current context
//int is a type which is not valid in the current context
quelqu'un aurait t-il une idée
merci