我可以在 XSD C# 生成的类创建的 XML 中的同一标记处具有空属性和其他属性吗?

Can I have null attribute and other attribute at the same tag in XML created by XSD C# generated class?(我可以在 XSD C# 生成的类创建的 XML 中的同一标记处具有空属性和其他属性吗?)
本文介绍了我可以在 XSD C# 生成的类创建的 XML 中的同一标记处具有空属性和其他属性吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我有一堆 C# 类,它们是从 XSD 自动生成的.然后我根据这些 C# 类生成 XML 文件.到目前为止什么都不存在.

问题:

生成的 XML 文件正在通过验证,验证需要为所有带有 xsi:nil="true" 的 XML 标记添加一个额外属性.基本上标签应该看起来像:<testTag.01 xsi:nil="true" NV="123123"/>,但我无法在 C# 中实现.我的代码是:

<块引用>

 if (myObject.TestTag.HasValue){t.testTag01 = 新的 testTag01();t.testTag01.Value = myObject.TestTag.Value;}//别的//{//t.testTag01 = new testTag01();//t.testTag01.NV = "123123";//未记录/
                
本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

Multicast delegate weird behavior in C#?(C# 中的多播委托奇怪行为?)
Parameter count mismatch with Invoke?(参数计数与调用不匹配?)
How to store delegates in a List(如何将代表存储在列表中)
How delegates work (in the background)?(代表如何工作(在后台)?)
C# Asynchronous call without EndInvoke?(没有 EndInvoke 的 C# 异步调用?)
Delegate.CreateDelegate() and generics: Error binding to target method(Delegate.CreateDelegate() 和泛型:错误绑定到目标方法)