Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How Do You Compare Strings In C#?
Message
 
À
07/01/2005 10:06:29
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
00975060
Message ID:
00975093
Vues:
16
You have the right idea, but the keyword int is equal to System.Int32 and you convert it using Conver.ToInt16 and the max value for Int16 is 32767. Use Conver.ToInt32 instead:
int nD1 = Convert.ToInt32(d1);
int nD2 = Convert.ToInt32(d2);

if (nD1 < nD2)
  MessageBox.Show("nD1 is less than nD2");
else
  MessageBox.Show("nD1 is NOT less than nD2");
Einar


>Sounds like it should be fairly simple...
>
>
>int nD1 = Convert.ToInt16(d1);
>int nD2 = Convert.ToInt16(d2);
>
>if (nD1 < nD2) {return -1;}
>
Semper ubi sub ubi.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform