当前位置: 首页>>代码示例>>C#>>正文


C# IMemberContext.GetActualType方法代码示例

本文整理汇总了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);
        }
开发者ID:kimbirkelund,项目名称:SekhmetSerialization,代码行数:16,代码来源:XmlSerializerCollectionMapper.cs

示例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;
        }
开发者ID:kimbirkelund,项目名称:SekhmetSerialization,代码行数:11,代码来源:CollectionSerializerSelector.cs

示例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();
 }
开发者ID:kimbirkelund,项目名称:SekhmetSerialization,代码行数:8,代码来源:XmlSerializerCollectionMapper.cs

示例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();
 }
开发者ID:kimbirkelund,项目名称:SekhmetSerialization,代码行数:7,代码来源:XmlSerializerCollectionMapper.cs

示例5: NameElementFromActualType

        private static XName NameElementFromActualType(IMemberContext memberContext)
        {
            var actualType = memberContext.GetActualType();
            if (actualType == null)
                return null;

            return actualType.Name.SafeToXName();
        }
开发者ID:kimbirkelund,项目名称:SekhmetSerialization,代码行数:8,代码来源:XmlSerializerCollectionMapper.cs


注:本文中的IMemberContext.GetActualType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。