本文整理汇总了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());
}
示例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());
}
示例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);
}
示例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()));
}
示例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));
}