I am not sure if this is the right forum to ask my question, if not please anyone let me know the better one.
I am developing an application which allows a user to enter c# code and it is built at runtime.
I also want to provide the user a simplified intelli-sense like feature. So when the mouse is moved over an identifier in the code text I want to display the details like type, value and parameters if it is a method name.
Currently I am facing with the following problem : assume the code is error-free and I can compile it. Let's say there is an identifier in the code named Foo.Whatewer.Something. The compiler obviously understands this. How can I get some information about an identifier if I only know its name "Foo.Whatever.Something" ?
There is well-defined object model in the built runtime code and I have the type and instance of the referring class (the class containing the code with the identifier "Foo.Whatewer.Something" ). Currently I am making assumptions that Foo is a variable in the referring object and I can use reflection this way to get the information I want.
But this is too specific and does not work if the user code refers to a class outside of my defined object model, for instance to a File class.
I want to have a more general approach, the way the compiler can resolve the reference.
What is the correct way ? Any ideas please ?