I have a number of internal classes in a library DLL that I'm creating. These classes have access via some public methods. A sample internal class is;
internal class MyClass
{
internal int Id {get;set;}
internal string Name {get;set;}
}
I need to serialise the object before being returned to the public method. I'm trying to use the XmlSerialise method like
System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(MyObject.GetType());
But when I try this I get the error
Error Inaccessible due to its protection level. Only public types can be processed
How can I overcome this problem, because I want to keep these internal classes private within the library DLL, and they can only be access using the public methods.