Please see my comment to the question. The question, as it is, makes no sense at all. But perhaps it would make some marginal sense if you clarify things. I doubt, though.
I was the question on MSDN forum you referenced. That question certainly makes no sense.
The author of this question forgets that we are talking about language based on compilation, not interpretive. Please see:
http://en.wikipedia.org/wiki/Programming_language[
^],
http://en.wikipedia.org/wiki/Compiler[
^].
Skipping long explanations of languages and their
paradigms, you are trying to break through the major paradigm of mainstream types of languages, mentally. I cannot lead you anywhere. The main problem is: if you clearly described your ultimate goals, you could get some advise withing the .NET paradigm and the paradigm of compiled, strongly typed languages.
In addition to that, you probably misuse the term "variable". All you are talking about could be conceptually applied to types, to members of these types, but not to "variables". In CLI, this term is reduced to the notion of stack variable only (local variables). Unlike types and members, which really have names and are represented by some object during runtime (accessible through reflection), local variable do not even exist; they exist only in source code and converted to some IL code and later to some native CPU-level addressing during JIT compilation. The names of variables already disappear at the stage of compilation to IL.
They virtually do not exist.
Even if you agree to consider only types and their member, which really have names, you should remember that they are statically known at the moment of compilation and cannot be changed. But, at best, you can dynamically create an assembly during runtime using
System.Reflection.Emit
, or create such assembly using CodeDOM, or, create some assembly in any way and load it dynamically during design time.
Remember: the whole assembly. Besides, you cannot unload loaded assembly. To unload it, you would creates a whole separate Application Domain, load an assembly in it, work with it through the domain boundary (which means using IPC), and, eventually, unload the whole domain. If you really want to consider one of those technologies, read on them; the documentation is readily available. Remember that using
System.Reflection.Emit
will require good understanding of IL and hard to debug. If you have questions on either of those technologies, I'll answer.
You might be interested to read on related topics:
http://en.wikipedia.org/wiki/Reflection_%28computer_programming%29[
^],
http://msdn.microsoft.com/en-us/library/f7ykdhsy%28v=vs.110%29.aspx[
^],
http://msdn.microsoft.com/en-us/library/system.reflection.emit(v=vs.110).aspx[
^],
http://msdn.microsoft.com/en-us/library/y2k85ax6%28v=vs.110%29.aspx[
^],
http://msdn.microsoft.com/en-us/library/system.codedom%28v=vs.110%29.aspx[
^],
http://msdn.microsoft.com/en-us/library/system.appdomain%28v=vs.110%29.aspx[
^],
http://en.wikipedia.org/wiki/Inter-process_communication[
^].
However, I suspect that you would be trying to
kill an ant by a ballistic inter-continental rocket. The problems you mentioned so far are much, much simper than what we discussed so far. "Threads can not be restarted"? Nonsense. Threads can easily be reused. You just should use some thread during all the lifetime of the application, by looping it, never terminated.
This is not easy, this is very easy. And so on…
Anyway, you can really step back and stop describing fantastic features you seem to "want". You need to explain your ultimate goal. Not what you explained so far. Ultimate.
—SA