奇怪的属性xsd c# [英] strange property xsd c#
问题描述
您好。
我正在尝试将使用c#中的xsd.exe生成的对象模型的属性转换为c ++。
我没有必须序列化或反序列化功能,我只会在c ++中创建一个反映c#obect模型的简单对象模型。
我使用反射。
我的问题是这样的:
[代码]
[System.CodeDom.Compiler.GeneratedCodeAttribute(" xsd"," 2.0.50727.3038")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
$
[System.ComponentModel.DesignerCategoryAttribute(" code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true,Namespace =" http://www.iai-tech.org/ifcXML/IFC2x3/FINAL")]¥b $ b ; public partial class IfcFillAreaStyleHatchingStartOfNextHatchLine
{
私人物品itemField;
$
///< remarks />
[System.Xml.Serialization.XmlElementAttribute(" IfcOneDirectionRepeatFactor",typeof(IfcOneDirectionRepeatFactor),IsNullable = true)]¥b $ b [System.Xml.Serialization.XmlElementAttribute(" IfcPositiveLengthMeasure",typeof(IfcPositiveLengthMeasure1),IsNullable = true)]¥b $ b [System.Xml.Serialization.XmlElementAttribute(" IfcTwoDirectionRepeatFactor",typeof(IfcTwoDirectionRepeatFactor),IsNullable = true)] $
公共对象项目
{
得到
{
return this.itemField;
}
设为
{
this.itemField = value;
}
}
}
[/ code]
如何在c ++中创建一个simil类?
这是什么意思物业?
[代码]
[System.Xml.Serialization.XmlElementAttribute(" IfcOneDirectionRepeatFactor",typeof(IfcOneDirectionRepeatFactor),IsNullable = true)]¥b $ b [System.Xml.Serialization.XmlElementAttribute(" IfcPositiveLengthMeasure",typeof(IfcPositiveLengthMeasure1),IsNullable = true)]¥b $ b [System.Xml.Serialization.XmlElementAttribute(" IfcTwoDirectionRepeatFactor",typeof(IfcTwoDirectionRepeatFactor),IsNullable = true)] $
公共对象项目
{
得到
{
return this.itemField;
}
设为
{
this.itemField = value;
}
}
[/ code]
为什么类型是对象而不是复杂/简单类型?
谢谢。
Hello.
I'm trying to convert the properties of an object model generated with xsd.exe in c# to c++.
I don't must have serialize or deserialize features, i would create only a simple object model in c++ that reflect the c# obect model.
I use reflection.
my problem is this:
[code]
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.3038")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "http://www.iai-tech.org/ifcXML/IFC2x3/FINAL")]
public partial class IfcFillAreaStyleHatchingStartOfNextHatchLine
{
private object itemField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("IfcOneDirectionRepeatFactor", typeof(IfcOneDirectionRepeatFactor), IsNullable = true)]
[System.Xml.Serialization.XmlElementAttribute("IfcPositiveLengthMeasure", typeof(IfcPositiveLengthMeasure1), IsNullable = true)]
[System.Xml.Serialization.XmlElementAttribute("IfcTwoDirectionRepeatFactor", typeof(IfcTwoDirectionRepeatFactor), IsNullable = true)]
public object Item
{
get
{
return this.itemField;
}
set
{
this.itemField = value;
}
}
}
[/code]
how i can create a simil class in c++?
Whats mean this property ?
[code]
[System.Xml.Serialization.XmlElementAttribute("IfcOneDirectionRepeatFactor", typeof(IfcOneDirectionRepeatFactor), IsNullable = true)]
[System.Xml.Serialization.XmlElementAttribute("IfcPositiveLengthMeasure", typeof(IfcPositiveLengthMeasure1), IsNullable = true)]
[System.Xml.Serialization.XmlElementAttribute("IfcTwoDirectionRepeatFactor", typeof(IfcTwoDirectionRepeatFactor), IsNullable = true)]
public object Item
{
get
{
return this.itemField;
}
set
{
this.itemField = value;
}
}
[/code]
why the type is object and not a complex/simple type?
thanks.
推荐答案
如果我理解正确,你不需要将C#类转换为C ++ ... ...
If I understand you correctly, you don't need to sweat to convert the C# classes in to C++...
XSD.Exe有一个/ language标志,支持为C ++创建类(使用/ language:CPP)。
The XSD.Exe has a /language flag which supports creating the classes for C++ ( use /language:CPP ).
只需在命令提示符下键入"XSD.exe"即可。 ,这将列出所有可用的选项 ...
Just type in the command prompt "XSD.exe" , which will list all the options available ...
/ language:< language>
用于生成代码的语言。选择'CS','VB','JS',
'VJS',' CPP'或为实施以下项目提供完全合格的名称b $ b System.CodeDom.Compiler.CodeDomProvider。默认语言
是'CS'(CSharp)。简称是'/ l:'。
/language:<language>
The language to use for the generated code. Choose from 'CS', 'VB', 'JS',
'VJS', 'CPP' or provide a fully-qualified name for a class implementing
System.CodeDom.Compiler.CodeDomProvider. The default language
is 'CS' (CSharp). Short form is '/l:'.
希望这有帮助......
Hope this helps....
这篇关于奇怪的属性xsd c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!