In a plugin written in C# I need to store custom UserData (“MyMetadata”) in several objects, where this objects can share the same instance of MyMetadata.
For some reason I can’t store my data in the UserData property of the attributes, because every time I do it in the second object, the reference in the first object becomes null. As it says in the description of the UserDataList.Add() method:
If the userdata is already in a different UserDataList, it will be removed from that list and added to this list.
Is there any way to avoid this inconvenience?
My intent is to use the UserDictionary property instead, as my data is not just strings. However I get this exception :
System.Reflection.AmbiguousMatchException: Ambiguous match found. at System.DefaultBinder.SelectMethod(BindingFlags bindingAttr, MethodBase match, Type types, ParameterModifier modifiers) at System.RuntimeType.GetMethodImpl(String name, BindingFlags bindingAttr, Binder binder, CallingConventions callConv, Type types, ParameterModifier modifiers) at System.Type.GetMethod(String name, Type types) at Rhino.Collections.ArchivableDictionary.AddContentsFrom(ArchivableDictionary source)
and the same happens with UserDictionary.ReplaceContentsWith().
My dictionary input comes from a method of MyMetadata which has not given me problems before to save the same data in the document, in the UserData property in the objects. But because it can’t be shared in several objects, I need an alternative. Please help, I have no idea how to deal with this exception, since it doesn’t look like my code or there’s no documentation to use the method properly…