Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Hey, is this where I'm gonna use REFLECTION?
Message
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Hey, is this where I'm gonna use REFLECTION?
Divers
Thread ID:
00851624
Message ID:
00851624
Vues:
53
I think I've been waiting for this day.

I have the name of a public property stored to a private field. I want to obtain the value stored in the public property. How can I evaluate the contents of the private field to query the correct public property?

Here's an example of what I'm trying to do:
public class Class1
{
   private string Property_Name = "MyValue";
   
   public string MyValue
   {
      get
      {
         return "Radiohead"
      }
   }
   
   public void ShowPropertyValue()
   {
      Console.WriteLine("The value of {0} is {1}",
         this.Property_Name,
         <<WHAT GOES HERE??>>);
   }
}
Note the "WHAT GOES HERE??" in the ShowPropertyValue() method.

Note too that I'm going to need to *reverse* this operation - store a new value to the specified property.

Thanks.
>>-Steve->>

Steve Sawyer
Geeks and Gurus, Inc.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform