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


C# MemberInfo.GetReturnType方法代码示例

本文整理汇总了C#中System.Reflection.MemberInfo.GetReturnType方法的典型用法代码示例。如果您正苦于以下问题:C# MemberInfo.GetReturnType方法的具体用法?C# MemberInfo.GetReturnType怎么用?C# MemberInfo.GetReturnType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Reflection.MemberInfo的用法示例。


在下文中一共展示了MemberInfo.GetReturnType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetIdUnsavedValue

 /// <summary>
 /// Gets the unsaved value for the id.
 /// </summary>
 /// <param name="classType">Type of the entity.</param>
 /// <param name="member">The member.</param>
 /// <returns></returns>
 public object GetIdUnsavedValue(Type classType, MemberInfo member)
 {
     return _conventions.IdUnsavedValueConvention.GetUnsavedValue(member.GetReturnType());
 }
开发者ID:abolibibelot,项目名称:mongodb-csharp,代码行数:10,代码来源:AutoMappingProfile.cs

示例2: GetIdGenerator

 /// <summary>
 /// Gets the id generator for the member.
 /// </summary>
 /// <param name="classType"></param>
 /// <param name="member">The member.</param>
 /// <returns></returns>
 public IIdGenerator GetIdGenerator(Type classType, MemberInfo member)
 {
     return _conventions.IdGeneratorConvention.GetGenerator(member.GetReturnType());
 }
开发者ID:abolibibelot,项目名称:mongodb-csharp,代码行数:10,代码来源:AutoMappingProfile.cs

示例3: CreateKey

 /// <summary>
 ///   Creates the key.
 /// </summary>
 /// <param name = "memberInfo">The member info.</param>
 /// <returns></returns>
 private static string CreateKey(MemberInfo memberInfo)
 {
     return string.Format("{0}_{1}_{2}_{3}",
         memberInfo.DeclaringType.FullName,
         memberInfo.MemberType,
         memberInfo.GetReturnType(),
         memberInfo.Name);
 }
开发者ID:ngocthanhit,项目名称:mongodb-csharp,代码行数:13,代码来源:MemberReflectionOptimizer.cs

示例4: GetDefaultValue

 /// <summary>
 /// Gets the default value.
 /// </summary>
 /// <param name="classType">Type of the class.</param>
 /// <param name="member">The member.</param>
 /// <returns></returns>
 public virtual object GetDefaultValue(Type classType, MemberInfo member)
 {
     object defaultValue = null;
     var att = member.GetCustomAttribute<MongoDefaultAttribute>(true);
     if (att != null)
         defaultValue = att.Value;
     return defaultValue ?? (_conventions.DefaultValueConvention.GetDefaultValue(member.GetReturnType()));
 }
开发者ID:abolibibelot,项目名称:mongodb-csharp,代码行数:14,代码来源:AutoMappingProfile.cs

示例5: CreateMemberMap

        private PersistentMemberMap CreateMemberMap(Type classType, MemberInfo member){
            var memberReturnType = member.GetReturnType();

            var dictionaryAdapter = _profile.GetDictionaryAdapter(classType, member, memberReturnType);
            if (dictionaryAdapter != null)
                return new DictionaryMemberMap(
                    member.Name,
                    MemberReflectionOptimizer.GetGetter(member),
                    MemberReflectionOptimizer.GetSetter(member),
                    _profile.GetAlias(classType, member),
                    _profile.GetPersistDefaultValue(classType, member),
                    dictionaryAdapter);

            var collectionType = _profile.GetCollectionAdapter(classType, member, memberReturnType);
            if(collectionType != null)
                return new CollectionMemberMap(
                    member.Name,
                    memberReturnType,
                    MemberReflectionOptimizer.GetGetter(member),
                    MemberReflectionOptimizer.GetSetter(member),
                    _profile.GetAlias(classType, member),
                    _profile.GetPersistDefaultValue(classType, member),
                    collectionType,
                    _profile.GetCollectionElementType(classType, member, memberReturnType));

            //TODO: reference checking...

            return new PersistentMemberMap(
                member.Name,
                memberReturnType,
                MemberReflectionOptimizer.GetGetter(member),
                MemberReflectionOptimizer.GetSetter(member),
                _profile.GetDefaultValue(classType, member),
                _profile.GetAlias(classType, member),
                _profile.GetPersistDefaultValue(classType, member));
        }
开发者ID:jango2015,项目名称:MongoDB_Client_.Net,代码行数:36,代码来源:AutoMapper.cs


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