// Now that the key and value (string and object) been assigned, how can I check if the ley is indeed "532Key" then get the values of tmpClass within the dictionary and process each element of the object assigning each to a class property (let call the new class newClass which have a,b, and c as properties). Thanks in advnce.

Does not seem to make sense. Why checking the key? If it is "523Key", it will be it all the time. You are missing something.
What do you mean by "class property"? A static property? (as others are "instance properties")? "Process each element of the object assigning each to a class property" really sounds like "assign each element to itself".
--SA

hi Sergey, it will have other keys, I just used this key as an example. There is logic that will make use of the different keys in the dictionary that is why I have to do this sort of a check. the class I am using in my example have public strings/int that are using set and get.

2 solutions

Solution 1

dict.ContainsKey lets you check if a key exists. You can iterate over dict.Keys and then look up each value as you go. But, you will struggle when you're using 'object', your best bet is to use the 'as' keyword to iterate over a list of possible types, and if you're doing that, you're better off strongly defining a class that contains those types. using string -> object will greatly complicate your code. string mapping to someClass would work way better.

Thank you for your feedback, I wonder if you have an example of how to use "as" in looping through the object to read and assign each element. I will place this "if" statment first:
if(dict.ContiansKey["532key"])

{
do the looping to read and assign the values in the "object" - but not sure how to do it
}