相关疑难解决方法(0)

C# XML serialization of derived classes

Hi I am trying to serialize an array of objects which are derived from a class and I keep hitting the same error using c#. Any help is much appreciated.

obviously this example has been scaled down for the purpose of this post in the real world Shape would contain a plethora of different shapes.

Program.cs

namespace XMLInheritTests
{
    class Program
    {
        static void Main(string[] args)
        {
            Shape[] a = new Shape[1] { new Square(1) };

            FileStream fS = new …
Run Code Online (Sandbox Code Playgroud)

c# xml class derived

15
推荐指数
1
解决办法
2万
查看次数

标签 统计

c# ×1

class ×1

derived ×1

xml ×1