Platform.Xml.Serialization.SerializationMemberInfo.GetFirstApplicableAttribute C# (CSharp) Method

GetFirstApplicableAttribute() public method

public GetFirstApplicableAttribute ( Type type ) : XmlSerializationAttribute
type System.Type
return XmlSerializationAttribute
        public XmlSerializationAttribute GetFirstApplicableAttribute(Type type)
        {
            return GetFirstApplicableAttribute(true, type);
        }

Same methods

SerializationMemberInfo::GetFirstApplicableAttribute ( bool includeTypeAttributes ) : XmlSerializationAttribute
SerializationMemberInfo::GetFirstApplicableAttribute ( bool includeTypeAttributes, Type type ) : XmlSerializationAttribute

Usage Example

Esempio n. 1
0
		public ListTypeSerializer(SerializationMemberInfo memberInfo, TypeSerializerCache cache, SerializerOptions options)
			: base(memberInfo, memberInfo.ReturnType, cache, options)
		{
			typeToItemMap = new Dictionary<Type, ListItem>();
			aliasToItemMap = new Dictionary<string, ListItem>();

			var attribute = (XmlListElementDynamicTypeProviderAttribute)memberInfo.GetFirstApplicableAttribute(typeof(XmlListElementDynamicTypeProviderAttribute));

			if (attribute != null)
			{
				if (dynamicTypeResolver == null)
				{
					try
					{
						dynamicTypeResolver  = (IXmlListElementDynamicTypeProvider)Activator.CreateInstance(attribute.ProviderType, new object[0]);
					}
					catch (Exception)
					{
					}
				}

				if (dynamicTypeResolver == null)
				{
					dynamicTypeResolver = (IXmlListElementDynamicTypeProvider)Activator.CreateInstance(attribute.ProviderType, new object[] {memberInfo, cache, options});
				}
			}

			serializationMemberInfo = memberInfo;

			this.cache = cache;

			Scan(memberInfo, cache, options);
		}
All Usage Examples Of Platform.Xml.Serialization.SerializationMemberInfo::GetFirstApplicableAttribute