May I dont know how too look for it, but fact is I cant find anything that helps me.
Is there a way to call property from a parent class like an assoc array (dictionary) ?
Sample:
using System;
class Foobar
{
public string bla;
public Foobar()
{
this.bla = "hello world";
}
}
public class Test
{
public static void Main()
{
Foobar x = new Foobar();
Console.WriteLine(x.bla); //this works (prints hello world)
Console.WriteLine(x["bla"]); //this wont work but is my achivment
}
}
To clarify what I want is...
I want to create a class that has some propertys e.g
class SomeClass
{
private string aaa {get;set;};
private string bbb {get;set;};
private string ccc {get;set;};
private string ddd {get;set;};
....
}
and than loop this in a other class by a dictionary
SomeClass x = new SomeClass();
IDictionary<string, string> dict = new Dictionary<string, string>();
dict["a"] = "aaa";
dict["b"] = "bbb";
dict["d"] = "ddd";
foreach( d in dict )
{
someMethode(x[d]);
}