本文整理汇总了C#中IType.ToTypeReference方法的典型用法代码示例。如果您正苦于以下问题:C# IType.ToTypeReference方法的具体用法?C# IType.ToTypeReference怎么用?C# IType.ToTypeReference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IType
的用法示例。
在下文中一共展示了IType.ToTypeReference方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EventCreationCompletionData
public EventCreationCompletionData(string handlerName, IType delegateType, IEvent evt, string parameterList, IUnresolvedMember callingMember, IUnresolvedTypeDefinition declaringType, CSharpResolver contextAtCaret)
{
if (string.IsNullOrEmpty(handlerName)) {
handlerName = (evt != null ? evt.Name : "Handle");
}
this.handlerName = handlerName;
this.DisplayText = "<Create " + handlerName + ">";
this.delegateTypeReference = delegateType.ToTypeReference();
this.isStatic = callingMember != null && callingMember.IsStatic;
}
示例2: EventCreationCompletionData
public EventCreationCompletionData(string handlerName, IType delegateType, IEvent evt, string parameterList, IUnresolvedMember callingMember, IUnresolvedTypeDefinition declaringType, CSharpResolver contextAtCaret)
{
if (string.IsNullOrEmpty(handlerName)) {
handlerName = (evt != null ? evt.Name : "Handle");
}
this.handlerName = handlerName;
this.DisplayText = StringParser.Parse("${res:CSharpBinding.Refactoring.EventCreation.EventHandlerText}", new[] { new StringTagPair("HandlerName", handlerName) });
this.delegateTypeReference = delegateType.ToTypeReference();
this.isStatic = callingMember != null && callingMember.IsStatic;
}
示例3: Import
/// <summary>
/// Imports a type from another compilation.
/// </summary>
public static IType Import(this ICompilation compilation, IType type)
{
if (compilation == null)
throw new ArgumentNullException("compilation");
if (type == null)
return null;
return type.ToTypeReference().Resolve(compilation.TypeResolveContext);
}
示例4: Import
/// <summary>
/// Imports a type from another compilation.
/// </summary>
public static IType Import(this ICompilation compilation, IType type)
{
if (compilation == null)
throw new ArgumentNullException("compilation");
if (type == null)
return null;
var compilationProvider = type as ICompilationProvider;
if (compilationProvider != null && compilationProvider.Compilation == compilation)
return type;
IEntity typeParameterOwner = GetTypeParameterOwner(type);
IEntity importedTypeParameterOwner = compilation.Import(typeParameterOwner);
if (importedTypeParameterOwner != null) {
return type.ToTypeReference().Resolve(new SimpleTypeResolveContext(importedTypeParameterOwner));
} else {
return type.ToTypeReference().Resolve(compilation.TypeResolveContext);
}
}
示例5: Get
public BridgeType Get(IType type, bool safe = false)
{
if (type.IsParameterized)
{
type = ((ParameterizedTypeReference)type.ToTypeReference()).GenericType.Resolve(this.Emitter.Resolver.Resolver.TypeResolveContext);
}
else if(type.Kind == TypeKind.Array) {
return typesOfKey_["System.Array"];
}
var bridgeType = typesOfIType_.GetOrDefault(type);
if(bridgeType != null) {
return bridgeType;
}
if (!safe)
{
throw new Exception("Cannot find type: " + type.ReflectionName);
}
return null;
}