pls create a sample for me on how to use System.Reflection.PropertyInfo

  • Thread starter Thread starter @@Worker
  • Start date Start date
@@Worker said:
can someone write a sample here?

using System;
using System.Reflection;

class App
{
private string _value = "Hello World";

static void Main(string[] args)
{
App app = new App();
Console.WriteLine(typeof(App).GetField("_value",
BindingFlags.Instance | BindingFlags.NonPublic
).GetValue(app));
}
}

-- Barry
 
thanks a lot.

Barry Kelly said:
@@Worker said:
can someone write a sample here?

using System;
using System.Reflection;

class App
{
private string _value = "Hello World";

static void Main(string[] args)
{
App app = new App();
Console.WriteLine(typeof(App).GetField("_value",
BindingFlags.Instance | BindingFlags.NonPublic
).GetValue(app));
}
}

-- Barry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top