Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
C# version of VFP PEMSTATUS()
Message
De
20/01/2010 12:28:26
 
 
À
20/01/2010 12:08:48
John Baird
Coatesville, Pennsylvanie, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01444636
Message ID:
01445018
Vues:
41
>>>You can also use linQ to see if the property exists and to return the properties value.
>>>
>>>if( MyClass.GetType().GetProperty (propName) != null)
>>>{
>>>     object propValue = MyClass.GetType().GetProperty(propName).GetValue(MyClass, new object[]{});
>>>}
>>>

>>
>>I'm with Viv on this one ... that's just Reflection, same as I used. There is no LINQ in your example at all.
>>
>>~~Bonnie
>
>Sorry, I was typing between waiting for my current work to build. I meant to say LinQ/Reflection. You can use linq or you can use reflection to get the same results.
>
>Charlei Calverts book shows both forms.

You can't do it using Linq alone. The Liinq example you referred to relies on the GetMembers() extension method which, in turn, relies on reflection......
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform