C# multiple key/value pairs of various types in a single line of code...?

Is there a way to create an object with multiple key/value pairs of differing types in C# like we can with Hashtables in UnityScript in a single line of code?

UnityScript:

var exampleHashtable:Hashtable = {“exampleString”:“string”, “exampleInt”:1, "exampleBoolean:true};

C#

??? containingObj = {“exampleString”:“string”, “exampleInt”:1, "exampleBoolean:true};

How about using a Dictionary<string, Object> With that you provide a KeyName (string) and and object of any type.

Something like …

Dictionary<string, object> Parameters = new Dictionary<string, object>();
Parameters.Add("Key1", "A string");
Parameters.Add("Key2", true);
Parameters.Add("Key3", 42);

The above should create a dictionary holding a string, a bool and an int.

They can be referenced like …

string a = Parameters["Key1"] as string;
bool? b = Parameters["Key2"] as bool?;
int? c = Parameters["Key3"] as int?;

I believe this will accomplish what you are wanting.

Hope it helps,

-Larry