Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to select a field by name
Message
 
 
À
27/08/2012 14:34:09
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Divers
Thread ID:
01551564
Message ID:
01551609
Vues:
62
>Okay, this is evidence that I've thought like a VFP programmer for a long time. What I want to do might look something like this:
>
>
>public class MyClass()
>{ 
>    DataRow table1;
>    DataRow table2;
>
>    public void AssignRow(DataRow input)
>    {
>        tableName = input.Table.TableName; // (could be "table1" or "table2")
>        &tableName = input; //notice the clever use of VFP syntax...
>    }
>}
>
>
>Any way of doing this short of a potentially long select statement?
>
>Thanks

In the latest version of C# you can use dynamic keyword.

So,

dynamic d;
d = 5;
d = new SqlConnection();

etc.

But 'static when possible, dynamic when necessary'
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform