如何序列化用户控件中的属性?
我尝试了以下代码,但在创建 XmlSerializer 对象时出现了 InvalidOperationExceptio
MyUserControl userControl = new MyUserControl();
XmlSerializer serializer = new XmlSerializer(typeof(MyUserControl));
Stream stream = new MemoryStream();
TextWriter writer = new StreamWriter(stream);
serializer.Serialize(writer, userControl);
例外:
System.InvalidOperationException 未处理
H结果=-2146233079
消息=存在反映类型“Demo.MyUserControl”的错误。