本文整理汇总了C#中System.Xml.Serialization.XmlTypeMapMember类的典型用法代码示例。如果您正苦于以下问题:C# XmlTypeMapMember类的具体用法?C# XmlTypeMapMember怎么用?C# XmlTypeMapMember使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlTypeMapMember类属于System.Xml.Serialization命名空间,在下文中一共展示了XmlTypeMapMember类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: XmlTypeMapElementInfo
public XmlTypeMapElementInfo (XmlTypeMapMember member, TypeData type)
{
_member = member;
_type = type;
if (type.IsValueType && type.IsNullable)
_isNullable = true;
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:7,代码来源:XmlTypeMapElementInfo.cs
示例2: XmlMemberMapping
internal XmlMemberMapping (string memberName, string defaultNamespace, XmlTypeMapMember mapMem, bool encodedFormat)
{
_mapMember = mapMem;
_memberName = memberName;
if (mapMem is XmlTypeMapMemberAnyElement)
{
XmlTypeMapMemberAnyElement anyelem = (XmlTypeMapMemberAnyElement) mapMem;
XmlTypeMapElementInfo info = (XmlTypeMapElementInfo) anyelem.ElementInfo[anyelem.ElementInfo.Count-1];
_elementName = info.ElementName;
_namespace = info.Namespace;
if (info.MappedType != null) _typeNamespace = info.MappedType.Namespace;
else _typeNamespace = "";
}
else if (mapMem is XmlTypeMapMemberElement)
{
XmlTypeMapElementInfo info = (XmlTypeMapElementInfo) ((XmlTypeMapMemberElement)mapMem).ElementInfo[0];
_elementName = info.ElementName;
if (encodedFormat)
{
_namespace = defaultNamespace;
if (info.MappedType != null) _typeNamespace = "";
else _typeNamespace = info.DataTypeNamespace;
}
else
{
_namespace = info.Namespace;
if (info.MappedType != null) _typeNamespace = info.MappedType.Namespace;
else _typeNamespace = "";
_form = info.Form;
}
}
else
{
_elementName = _memberName;
_namespace = "";
}
if (_form == XmlSchemaForm.None)
_form = XmlSchemaForm.Qualified;
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:41,代码来源:XmlMemberMapping.cs
示例3: IsReadOnly
bool IsReadOnly (XmlTypeMapping map, XmlTypeMapMember member, TypeData memType, bool isValueList)
{
if (isValueList) return !memType.HasPublicConstructor;
else return member.IsReadOnly (map.TypeData.Type) || !memType.HasPublicConstructor;
}
开发者ID:thenextman,项目名称:mono,代码行数:5,代码来源:SerializationCodeGenerator.cs
示例4: CreateFieldMember
CodeTypeMember CreateFieldMember (CodeTypeDeclaration codeClass, XmlTypeMapMember member)
{
return CreateFieldMember (codeClass, GetDomType (member.TypeData, member.RequiresNullable), member.Name, member.DefaultValue, member.TypeData, member.Documentation);
}
开发者ID:carrie901,项目名称:mono,代码行数:4,代码来源:MapCodeGenerator.cs
示例5: GenerateMemberHasValueCondition
string GenerateMemberHasValueCondition (XmlTypeMapMember member, string ob, bool isValueList)
{
if (isValueList) {
if (member.IsOptionalValueType)
return ob + ".Length > " + Math.Max (member.GlobalIndex, member.SpecifiedGlobalIndex) + " && " + GetCast (typeof(bool), ob + "[" + member.SpecifiedGlobalIndex + "]");
else
return ob + ".Length > " + member.GlobalIndex;
}
else if (member.DefaultValue != System.DBNull.Value) {
string mem = ob + "[email protected]" + member.Name;
if (member.DefaultValue == null)
return mem + " != null";
else if (member.TypeData.SchemaType == SchemaTypes.Enum)
return mem + " != " + GetCast (member.TypeData, GetLiteral (member.DefaultValue));
else
return mem + " != " + GetLiteral (member.DefaultValue);
}
else if (member.IsOptionalValueType)
return ob + "[email protected]" + member.Name + "Specified";
return null;
}
开发者ID:thenextman,项目名称:mono,代码行数:21,代码来源:SerializationCodeGenerator.cs
示例6: CreateElementInfo
XmlTypeMapElementInfo CreateElementInfo (string ns, XmlTypeMapMember member, string name, TypeData typeData, bool isNillable, XmlSchemaForm form, int order)
{
if (typeData.IsComplexType)
return CreateElementInfo (ns, member, name, typeData, isNillable, form, GetTypeMapping (typeData), order);
else
return CreateElementInfo (ns, member, name, typeData, isNillable, form, null, order);
}
开发者ID:nestalk,项目名称:mono,代码行数:7,代码来源:XmlSchemaImporter.cs
示例7: CreateTextElementInfo
XmlTypeMapElementInfo CreateTextElementInfo (string ns, XmlTypeMapMember member, TypeData typeData)
{
XmlTypeMapElementInfo einfo = new XmlTypeMapElementInfo (member, typeData);
einfo.IsTextElement = true;
einfo.WrappedElement = false;
if (typeData.IsComplexType)
einfo.MappedType = GetTypeMapping (typeData);
return einfo;
}
开发者ID:nestalk,项目名称:mono,代码行数:9,代码来源:XmlSchemaImporter.cs
示例8: CreateFieldMember
CodeMemberField CreateFieldMember (XmlTypeMapMember member)
{
CodeMemberField codeField = new CodeMemberField (GetDomType (member.TypeData), member.Name);
codeField.Attributes = MemberAttributes.Public;
AddComments (codeField, member.Documentation);
if (member.DefaultValue != System.DBNull.Value)
GenerateDefaultAttribute (codeField, member.TypeData, member.DefaultValue);
return codeField;
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:11,代码来源:MapCodeGenerator.cs
示例9: AddMember
public void AddMember (XmlTypeMapMember member)
{
// If GlobalIndex has not been set, set it now
if (member.GlobalIndex == -1)
member.GlobalIndex = _allMembers.Count;
_allMembers.Add (member);
if (!(member.DefaultValue is System.DBNull) && member.DefaultValue != null) {
if (_membersWithDefault == null) _membersWithDefault = new ArrayList ();
_membersWithDefault.Add (member);
}
if (member.IsReturnValue)
_returnMember = member;
if (member is XmlTypeMapMemberAttribute)
{
XmlTypeMapMemberAttribute atm = (XmlTypeMapMemberAttribute)member;
if (_attributeMembers == null) _attributeMembers = new Hashtable();
string key = BuildKey (atm.AttributeName, atm.Namespace, -1);
if (_attributeMembers.ContainsKey (key))
throw new InvalidOperationException ("The XML attribute named '" + atm.AttributeName + "' from namespace '" + atm.Namespace + "' is already present in the current scope. Use XML attributes to specify another XML name or namespace for the attribute.");
member.Index = _attributeMembers.Count;
_attributeMembers.Add (key, member);
return;
}
else if (member is XmlTypeMapMemberFlatList)
{
RegisterFlatList ((XmlTypeMapMemberFlatList)member);
}
else if (member is XmlTypeMapMemberAnyElement)
{
XmlTypeMapMemberAnyElement mem = (XmlTypeMapMemberAnyElement) member;
if (mem.IsDefaultAny) _defaultAnyElement = mem;
if (mem.TypeData.IsListType) RegisterFlatList (mem);
}
else if (member is XmlTypeMapMemberAnyAttribute)
{
_defaultAnyAttribute = (XmlTypeMapMemberAnyAttribute) member;
return;
}
else if (member is XmlTypeMapMemberNamespaces)
{
_namespaceDeclarations = (XmlTypeMapMemberNamespaces) member;
return;
}
if (member is XmlTypeMapMemberElement && ((XmlTypeMapMemberElement)member).IsXmlTextCollector)
{
if (_xmlTextCollector != null) throw new InvalidOperationException ("XmlTextAttribute can only be applied once in a class");
_xmlTextCollector = member;
}
if (_elementMembers == null) {
_elementMembers = new ArrayList();
_elements = new Hashtable();
}
member.Index = _elementMembers.Count;
_elementMembers.Add (member);
ICollection elemsInfo = ((XmlTypeMapMemberElement)member).ElementInfo;
foreach (XmlTypeMapElementInfo elem in elemsInfo)
{
string key = BuildKey (elem.ElementName, elem.Namespace, elem.ExplicitOrder);
if (_elements.ContainsKey (key))
throw new InvalidOperationException ("The XML element named '" + elem.ElementName + "' from namespace '" + elem.Namespace + "' is already present in the current scope. Use XML attributes to specify another XML name or namespace for the element.");
_elements.Add (key, elem);
}
if (member.TypeData.IsListType && member.TypeData.Type != null && !member.TypeData.Type.IsArray) {
if (_listMembers == null) _listMembers = new ArrayList ();
_listMembers.Add (member);
}
}
开发者ID:rabink,项目名称:mono,代码行数:76,代码来源:XmlTypeMapping.cs
示例10: DefinedInBaseMap
bool DefinedInBaseMap (XmlTypeMapping map, XmlTypeMapMember member)
{
if (((ClassMap)map.ObjectMap).FindMember (member.Name) != null)
return true;
else if (map.BaseMap != null)
return DefinedInBaseMap (map.BaseMap, member);
else
return false;
}
开发者ID:Profit0004,项目名称:mono,代码行数:9,代码来源:XmlSchemaExporter.cs
示例11: GenerateSetMemberValueFromAttr
void GenerateSetMemberValueFromAttr (XmlTypeMapMember member, string ob, string value, bool isValueList)
{
// Enumeration values specified in custom attributes are stored as integer
// values if the custom attribute property is of type object. So, it is
// necessary to convert to the enum type before asigning the value to the field.
if (member.TypeData.Type.IsEnum)
value = GetCast (member.TypeData.Type, value);
GenerateSetMemberValue (member, ob, value, isValueList, true);
}
开发者ID:thenextman,项目名称:mono,代码行数:10,代码来源:SerializationCodeGenerator.cs
示例12: IsReadOnly
bool IsReadOnly (XmlTypeMapMember member, TypeData memType, object ob, bool isValueList)
{
if (isValueList) return !memType.HasPublicConstructor;
else return member.IsReadOnly (ob.GetType()) || !memType.HasPublicConstructor;
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:5,代码来源:XmlSerializationReaderInterpreter.cs
示例13: SetMemberValue
void SetMemberValue (XmlTypeMapMember member, object ob, object value, bool isValueList)
{
if (isValueList) ((object[])ob)[member.GlobalIndex] = value;
else {
member.SetValue (ob, value);
if (member.IsOptionalValueType)
member.SetValueSpecified (ob, true);
}
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:9,代码来源:XmlSerializationReaderInterpreter.cs
示例14: GenerateSetMemberValue
void GenerateSetMemberValue (XmlTypeMapMember member, string ob, string value, bool isValueList)
{
if (isValueList) WriteLine (ob + "[" + member.GlobalIndex + "] = " + value + ";");
else {
WriteLine (ob + "[email protected]" + member.Name + " = " + value + ";");
if (member.IsOptionalValueType)
WriteLine (ob + "." + member.Name + "Specified = true;");
}
}
开发者ID:tgiphil,项目名称:Mono-Class-Libraries,代码行数:9,代码来源:SerializationCodeGenerator.cs
示例15: XmlTypeMapElementInfo
public XmlTypeMapElementInfo (XmlTypeMapMember member, TypeData type)
{
_member = member;
_type = type;
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:5,代码来源:XmlTypeMapElementInfo.cs
示例16: IsReadOnly
bool IsReadOnly (XmlTypeMapMember member, object ob, bool isValueList)
{
if (isValueList) return false;
else return member.IsReadOnly (ob.GetType());
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:5,代码来源:XmlSerializationReaderInterpreter.cs
示例17: GenerateSetMemberValue
void GenerateSetMemberValue (XmlTypeMapMember member, string ob, string value, bool isValueList)
{
GenerateSetMemberValue (member, ob, value, isValueList, false);
}
开发者ID:thenextman,项目名称:mono,代码行数:4,代码来源:SerializationCodeGenerator.cs
示例18: GenerateReadArrayMemberHook
bool GenerateReadArrayMemberHook (Type type, XmlTypeMapMember member, string index)
{
SetHookVar ("$INDEX", index);
return GenerateReadMemberHook (type, member);
}
开发者ID:thenextman,项目名称:mono,代码行数:5,代码来源:SerializationCodeGenerator.cs
示例19: SetMemberValue
void SetMemberValue (XmlTypeMapMember member, object ob, object value, bool isValueList)
{
var memberType = member.TypeData.Type;
if (value != null && !value.GetType().IsAssignableFrom (memberType))
value = XmlSerializationWriterInterpreter.ImplicitConvert (value, memberType);
if (isValueList)
((object[])ob)[member.GlobalIndex] = value;
else
member.SetValue (ob, value);
if (member.IsOptionalValueType)
member.SetValueSpecified (ob, true);
}
开发者ID:xzkmxd,项目名称:mono,代码行数:13,代码来源:XmlSerializationReaderInterpreter.cs
示例20: GenerateReadMemberHook
bool GenerateReadMemberHook (Type type, XmlTypeMapMember member)
{
SetHookVar ("$MEMBER", member.Name);
return GenerateHook (HookType.member, HookDir.Read, type, member.Name);
}
开发者ID:thenextman,项目名称:mono,代码行数:5,代码来源:SerializationCodeGenerator.cs
注:本文中的System.Xml.Serialization.XmlTypeMapMember类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论