I'm trying to find a way that I can store a C# class into an AutoCAD entity as an XRecord. For example, I have the following class:
public class ExampleClass
{
private int x;
private int y;
public ExampleClass(int x, int y)
{
this.x = x;
this.y = y;
}
#region Getters and Setters
}
and I create an instance of it:
ExampleClass objToStoreInXRecord = new ExampleClass(3, 5);
What is the best way to store that into an AutoCAD entity's (for example a line in the drawing) XRecord so that I could do something like this:
ExampleClass objRecoveredFromXRecord = GetXRecordFromEntity(Entity e)
Where GetXRecordFromEntity(Entity e) is a helper method I can write that takes an entity e, gets the XRecord of the object I stored earlier, and returns it.
I don't have a very good handle on how XRecord works and how XRecord relates to AutoCAD's Named Object Dictionary (NOD). I've seen implementations where the object to be stored in an XRecord is serialized with a binary formatter and the serialized data is stored in the entity's XRecord but I'm looking for a better way.