Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How Do You Compare Strings In C#?
Message
De
08/01/2005 21:41:45
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
00975060
Message ID:
00975471
Vues:
13
Hello,

I read an article in Code magazine (Jul/Aug 2004 Page 26) talking about overloading the operators to do the things you want. Maybe you could try something like that.

Gordon.

>George,
>
>>PMFJI. First, I agree with you wholeheartedly. However, I think that the thinking on this in the design of .NET is what led to this.
>>
>>As you know, there're no "simple variables" in .NET. IOW, everything's an object. The standard C/C++ method of declaring, say, an integer applies, but it really isn't an integer, but an object. As a result, the standard comparison operators don't apply.
>
>If C# is as method centric Java, why the heck would they even define == to work with strings and not the other comparison operators? It's just so obtuse that they think == is the only useful operator. It does look like from the help file that if I defined a string subclass that I can provide my own override on the additional operators.
>
>>Hope you and your's had a happy holiday season.
>
>We did indeed. I hope it was the same for y'all.
Gordon de Rouyan
DC&G Consulting
Edmonton, Alberta
Email: derouyag@shaw.ca
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform