How to pass a Dictionary to an iOS function plugin ?

I want to wrap my iOS API that takes a NSDictionary in input, something like:

-(void) foo:(NSDictionary *) dict;

To do so I created a C# method that will call the previous the native iOS one:

public void foo(Dictionary<string, string> dict)

How can I marshall the C# Dictionary structure to an iOS NSDictionary ?

The easiest method, from what I’ve seen and researched, is to convert the dictionary to a string that is delimited by a special character set that you specify, and then re-parsing it into an NSMutableDictionary back on the native end. So, when taking pairs from the C# dictionary, you would delimit the key / value pairs with a special character set, and then each pair would also have to be delimited from each other so that you can parse it correctly on the OBJ-C side.

When parsing in OBJ-C with your character sets, you can simply use [NSArray componentsSeparatedByString:@“”] to parse your string for each pair, which of course has to be down twice: once for each key / value pair, and then once to separate each key from each value, and then spit it into a NSMutableDictionary.

I found another method by writing 3 native methods:

native_InitDict();
foreach (KeyValuePair<string, string> v in parameters) {
	native_InsertInDict(v.Key, v.Value);
}
native_FinishDict();