[Solved] Is it possible to name a variable using a method in c#?
[ad_1] What you will need to use to do this is the System.Dynamic.ExpandoObject class. using System; using System.Dynamic; using System.Collections.Generic; public class Program { public static void Main() { var args = “–Bar –Foo MyStuff”.Split(); var parsedArgs = ParseArgs(args); Console.WriteLine(parsedArgs.Foo); //Writes “MyStuff” Console.WriteLine(parsedArgs.Bar); //Writes true; Console.WriteLine(parsedArgs.NotDefined); //Throws run time exception. } public static dynamic ParseArgs(string[] … Read more