Click here to Skip to main content
15,891,375 members
Home / Discussions / C#
   

C#

 
AnswerRe: Set a psw to a directory Pin
mcaos10-Oct-07 10:43
professionalmcaos10-Oct-07 10:43 
GeneralRe: Set a psw to a directory Pin
Dave Kreskowiak10-Oct-07 15:08
mveDave Kreskowiak10-Oct-07 15:08 
GeneralRe: Set a psw to a directory Pin
TJoe11-Oct-07 2:35
TJoe11-Oct-07 2:35 
GeneralRe: Set a psw to a directory Pin
mcaos13-Oct-07 6:43
professionalmcaos13-Oct-07 6:43 
Questionms office current open files Pin
s3rro10-Oct-07 9:16
s3rro10-Oct-07 9:16 
Questionredirect printf from unmanaged DLL to C# textbox Pin
Daemon Black10-Oct-07 9:13
Daemon Black10-Oct-07 9:13 
AnswerRe: redirect printf from unmanaged DLL to C# textbox Pin
Dave Kreskowiak10-Oct-07 15:11
mveDave Kreskowiak10-Oct-07 15:11 
QuestionGet an object value using a string Pin
MrEyes10-Oct-07 8:15
MrEyes10-Oct-07 8:15 
Hello all,

Odd title, not an easy one to summarise. Basically I am trying to find a way of access an object value from a string that contains that objects name.

So, lets assume I have the following basic class

class NoddyClass
{
  public string foo;
  public string bar;
}


Which is used by the following

class NoddyProcess
{
  private NoddyClass nc;

  public NoddyProcess()
  {
    this.nc = new NoddyClass()
    this.nc.foo = "thingys";
    this.nc.bar = "doodars";
  }

  public void GetValueFromString(string value)
  {
    //A miracle occurs here 
  }
}

class AnotherNoddyProcess
{
  private void DoSomething()
  {
    NoddyProcess np = new NoddyProcess();
    np.GetValueFromString("foo");
  }
}


So putting all this together in the GetValueFromString method I need to access this.nc and using the passed string retrieve the value of this.nc.foo and return it to the caller.

I am assuming that this can be done with reflection, however I seem to have hit a wall on this and could do with a prod in the right direction.

P.S. I realise that in the examples given above none of this is actually necessary, however these are extemely simplfied versions of a much more complex framework.
AnswerRe: Get an object value using a string Pin
TJoe10-Oct-07 8:29
TJoe10-Oct-07 8:29 
AnswerRe: Get an object value using a string Pin
led mike10-Oct-07 8:30
led mike10-Oct-07 8:30 
GeneralRe: Get an object value using a string Pin
MrEyes10-Oct-07 8:47
MrEyes10-Oct-07 8:47 
GeneralRe: Get an object value using a string Pin
led mike10-Oct-07 8:59
led mike10-Oct-07 8:59 
GeneralRe: Get an object value using a string Pin
Patrick Etc.10-Oct-07 10:19
Patrick Etc.10-Oct-07 10:19 
AnswerRe: Get an object value using a string Pin
Kasdoffe10-Oct-07 9:08
Kasdoffe10-Oct-07 9:08 
QuestionHow to display image in DataList ? Pin
whale8410-Oct-07 6:32
whale8410-Oct-07 6:32 
QuestionHow to create a Link in a Worksheet using C# Pin
mkarthekeyan10-Oct-07 5:25
mkarthekeyan10-Oct-07 5:25 
AnswerRe: How to create a Link in a Worksheet using C# Pin
led mike10-Oct-07 6:08
led mike10-Oct-07 6:08 
AnswerRe: How to create a Link in a Worksheet using C# Pin
TJoe10-Oct-07 6:40
TJoe10-Oct-07 6:40 
GeneralRe: How to create a Link in a Worksheet using C# Pin
mkarthekeyan14-Oct-07 18:55
mkarthekeyan14-Oct-07 18:55 
QuestionAdding new rows to DataGridView UI in DataBound Mode Pin
Subrahmanyam K10-Oct-07 5:11
Subrahmanyam K10-Oct-07 5:11 
AnswerRe: Adding new rows to DataGridView UI in DataBound Mode Pin
led mike10-Oct-07 5:27
led mike10-Oct-07 5:27 
Questionturn off timer Pin
nhathoang10-Oct-07 4:48
nhathoang10-Oct-07 4:48 
AnswerRe: turn off timer Pin
Justin Perez10-Oct-07 5:09
Justin Perez10-Oct-07 5:09 
GeneralRe: turn off timer Pin
Anthony Mushrow10-Oct-07 8:26
professionalAnthony Mushrow10-Oct-07 8:26 
QuestionAccess Set() method inside UserControl Pin
66chawger10-Oct-07 4:43
66chawger10-Oct-07 4:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.