Update Sorry. I didn't mean the whole reflection library was off limits. I just meant the insanely slow *.Invoke() stuff.
Hi,
I need to implement a property system in C# that allows both normal property access
[property_attribute()]
return_type Property { get; set; }
and access by string
SetProperty(string name, object value);
object GetProperty(string name);
However,
- I do not want to register each property individually.
- I do not want to use reflection
- I do not want to access properties through a dictionary (i.e. no
PropertyTable["abc"]=val;
)
This scheme is required for a cluster computing scheme where I have to set properties remotely and locally. All the properties will have a custom attribute that will be read at initalization. I hope to get constant run-time performance.
Currently, my idea is to have a custom parser/preprocesser parse/compile the scripts at runtime and generate the set/get code as follows:
object GetProperty(string name)
{
if(name = "blah")
return Property1;
...
}
...
However, I won't be able to debug the code with this scheme. Can anyone think of a solution?
Thanks