本文整理汇总了C#中IMemberContext.GetActualType方法的典型用法代码示例。如果您正苦于以下问题:C# IMemberContext.GetActualType方法的具体用法?C# IMemberContext.GetActualType怎么用?C# IMemberContext.GetActualType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMemberContext
的用法示例。
在下文中一共展示了IMemberContext.GetActualType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MapForSerialization
public IEnumerable<IMapping<IMemberContext, XObject>> MapForSerialization(IMemberContext source, XElement target, IAdviceRequester adviceRequester)
{
if (source == null)
throw new ArgumentNullException("source");
var elementType = GetElementType(source.GetActualType());
if (elementType == null)
throw new ArgumentException("Collection mapper has been invoked for target that is not a known list type: '" + source.GetActualType() + "'.", "target");
var sourceObject = source.GetValue();
if (sourceObject == null)
return Enumerable.Empty<IMapping<IMemberContext, XObject>>();
return sourceObject.Members
.Select(CreateMapping);
}
示例2: Select
public ISerializer Select(IMemberContext source, XObject target, IAdviceRequester adviceRequester)
{
var actualType = _typeConverter.GetActualType(source.GetActualType(), adviceRequester);
if (actualType == null)
return null;
if (_log.IsDebugEnabled)
_log.Debug("Selected collection serialization for source '" + source + "' and target '" + target.ToFriendlyName() + "'.");
return _serializer;
}
示例3: NameElementFromElementAttributeExactType
private static string NameElementFromElementAttributeExactType(IMemberContext memberContext)
{
return memberContext.Attributes.OfType<XmlElementAttribute>()
.Where(a => a.Type == memberContext.GetActualType())
.Where(a => !string.IsNullOrWhiteSpace(a.ElementName))
.Select(a => a.ElementName)
.FirstOrDefault();
}
示例4: NameElementFromElementAttributeInstanceOfType
private static string NameElementFromElementAttributeInstanceOfType(IMemberContext memberContext)
{
return memberContext.Attributes.OfType<XmlElementAttribute>()
.Where(a => a.Type != null && memberContext.GetActualType().IsSubTypeOf(a.Type))
.Select(a => a.ElementName)
.FirstOrDefault();
}
示例5: NameElementFromActualType
private static XName NameElementFromActualType(IMemberContext memberContext)
{
var actualType = memberContext.GetActualType();
if (actualType == null)
return null;
return actualType.Name.SafeToXName();
}