Reputation: 5407
I need to create a NSDictionary
in Xamarin/C#
with YES
Value.
The NSDictionary
in Objective-C
looks like this:
NSDictionary *requestSettings = @{
kKeyOne : @YES,
kKeyTwo : @YES
};
I have no idea where in Xamarin
I can find the YES
keyword.
Upvotes: 3
Views: 2754
Reputation: 362
NSMutableDictionary dict = new NSMutableDictionary();
dict.Add("test", new NSNumber(true));
Upvotes: 9
Reputation: 32694
You can use CFBoolean.True and CFBoolean.False for your values.
Upvotes: 1
Reputation: 2654
To set values in Dictionary
Dictionary<string, bool> dictionary =
new Dictionary<string, bool>();
dictionary.Add("kKeyOne", true);
dictionary.Add("kKeyTwo", true);
To get the value -
bool value = dictionary["kKeyOne"];
Upvotes: 2