Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Syntax help VB.NET
Message
De
14/05/2009 10:41:56
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 8.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01399843
Message ID:
01399853
Vues:
75
>Hi All,
>
>Using VB.NET/C# syntax what would be the esiest way to implement the following logic:
>
>Having 3 numeric values as input validate if they are the same. Exclude zeros from validation so the following would be returned as valid:
>
>Val1: 250.99
>Val2: 0
>Val3: 250.99
>
>Thanks,
>daniel
double[] values = {250.99,0,250.99};
bool valuesEqual = values.Where( v => v != 0).All( v => v == values.Max() );
Oh VB it is, then:
dim values as double() = {250.99,0,250.99}
dim valuesEqual as boolean = values.Where( Function(v) v <> 0).All( Function(v) v = values.Max() )
dim valuesEqual as boolean = (values.Where( Function(v) v <> 0).Distinct().Count <= 1)
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform