Click here to Skip to main content
15,894,343 members
Please Sign up or sign in to vote.
1.57/5 (4 votes)
See more:
i want to create dynamic objects and call function with dynamic object name.
can anybody help me to find answer?

What I have tried:

Nothing tried.
Posted
Updated 24-Jan-17 18:45pm
v3
Comments
#realJSOP 7-Dec-16 8:24am    
I have absolutely no freakin idea what you're asking for...
[no name] 7-Dec-16 8:25am    
Are you stuck because you do not know how to ask a question? Nothing in your posting even remotely resembles a question.
Philippe Mori 7-Dec-16 10:25am    
If you have tried, then how come there is no code in What I have tried: section.

1 solution

No. There is no way to do that directly, as C# is a compiled language (unlike PHP which is interpreted) and requires all code to be compiled before ti is executed.
Having said that, you could do it: Compiling C# Code at Runtime[^] shows one way, but you would probably have to "encapsulate" your code in some kind of framework to get it all to work. A simple Google will find you others: compile and execute c - Google Search[^]

But...I'd think long and hard before I started with this: you are handing all control of your app and it's inner workings to whoever wants to bash together some code and get you to execute it. From a security POV, that's a nightmare - and from a reliability standpoint I could see a lot of bug reports coming that are caused by "user code" rather than yours.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900