我有一些类,狐狸例如添加XML属性属性
public class Test
{
[XmlElement(IsNullable = true)]
public string SomeProperty{get;set;}
}
当我序列化这个类的对象,我得到
<test>
<SomeProperty>value<someproperty>
<test>
但我需要添加属性SomeProperty 不改变结构类并得到这个
<test>
<SomeProperty Search="true">value<someproperty>
<test>
我怎样才能 去做?
PS:我知道,我可以写对象,包括“SomeProperty”和布尔财产“搜索”,但它会改变
类
如何/在哪里存储与Test实例一起搜索的值? –
这是一个问题。可能有一些属性存在 – cosset
也许不是。最好稍微回过头来问一下你真正需要做什么。这似乎是一个失败的解决方案的一半。 –