I am having a bit of trouble converting this little class from Python to C#, could anyone help me please?
So far I have this:
public class objDict
{
public objDict(Dictionary<object, object> obj)
{
foreach(KeyValuePair<object, object> kvp in obj)
{
}
}
}
For the rest I have no idea what to do.. I know just a little bit about Python
Here's the class:
class objDict(object):
def __init__(self, obj):
for k, v in obj.iteritems():
if isinstance(v, dict):
setattr(self, _to_str(k).title(), objDict(v))
else:
setattr(self, k, v)
def __getitem__(self, val):
return self.__dict__[val]
def __repr__(self):
return '{%s}' % str(', '.join('%s : %s' % (k, repr(v)) for (k, v) in self.__dict__.iteritems()))
Thanks in advance!