I have Data in MAP<String,sobject>
type map and I wants to put it in Map<String,object>
type Map. Please help with this casting.
1 Answer
Sure, you can just write:
Map<String, Object> widerMap = new Map<String, sObject>();
No casting is required to make this work. However, this is due to a bug in the compiler. If you use this technique, be very careful not to try and store an invalid data type in the value, or you'll get a runtime exception.