Can any one tell me what is equivalent of NSMutableDictionary(), NSMutableArray() ,NSArray And NSDictionary in C#
Asked
Active
Viewed 373 times
1 Answers
0
First, there is no difference from mutable
and immutable
on Array
and Dictionary
in C#.
We can both change the value after it is initialized. It means they are all Mutable
.
For NSMutableDictionary
and NSDictionary
Dictionary<string, object> dict = new Dictionary<string, object>();
dict["a"] = new NSString(); // set
var Object = dict["a"]; //get
For NSMutableArray
and NSArray
List<object> list = new List<object>();
list.Add(new NSString()); //set
NSString str = list[0] as NSString; //get

ColeX
- 14,062
- 5
- 43
- 240
-
BTW,we can also use `NSArray` ,`NSMutableArray` ,`NSMutableDictionary `,`NSDictionary` directly in `Xamarin.ios`. – ColeX Mar 26 '18 at 02:21
-
xia Thank you so much for your explanation. – xam Mar 26 '18 at 02:24
-
Actually I want I want to convert logic in xamarin.ios for xamarin.Android – xam Mar 26 '18 at 02:24
-
You can use Dictionary and List both on xamarin.ios and xamarin.Android. – ColeX Mar 26 '18 at 02:26
-
why can't we use Hash Map instead of Dictionary? – xam Mar 26 '18 at 02:28
-
You also can use Hashtable , but i think Dictionary is more friendly to use. – ColeX Mar 26 '18 at 02:31
-
https://stackoverflow.com/questions/1273139/c-sharp-java-hashmap-equivalent – ColeX Mar 26 '18 at 02:36