• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ITypeParameter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ITypeParameter的典型用法代码示例。如果您正苦于以下问题:C# ITypeParameter类的具体用法?C# ITypeParameter怎么用?C# ITypeParameter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ITypeParameter类属于命名空间,在下文中一共展示了ITypeParameter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: VisitTypeParameter

		public override IType VisitTypeParameter(ITypeParameter type)
		{
			// TODO: how to map type parameters?
			// It might have constraints, and those constraints might be mutually recursive.
			// Maybe reintroduce ITypeParameter.Owner?
			throw new NotImplementedException();
		}
开发者ID:hduregger,项目名称:monodevelop,代码行数:7,代码来源:MapTypeIntoNewContext.cs


示例2: TypeParameterCompletionData

 public TypeParameterCompletionData(ITypeParameter typeParameter)
 {
     TypeParameter = typeParameter;
     SetDefaultText(typeParameter.Name);
     DeclarationCategory = DeclarationCategory.Type_Parameter;
     //Documentation = typeParameter.GetDefinition().Documentation;
 }
开发者ID:uluhonolulu,项目名称:QCCodingServices.NET,代码行数:7,代码来源:TypeParameterCompletionData.cs


示例3: InstantiatedParameterType

		public InstantiatedParameterType (ProjectDom dom, ITypeParameterMember typeParameterMember, ITypeParameter tp)
		{
			IType outerType = typeParameterMember as IType ?? typeParameterMember.DeclaringType;
			typeparam = tp;
			compilationUnit = outerType.CompilationUnit;
			ClassType = ClassType.Class;
			Modifiers = Modifiers.Public;
			Name = tp.Name;
			Namespace = outerType.DecoratedFullName;
			Location = outerType.Location;
			DeclaringType = outerType;
			
			if (tp.Constraints.Count > 0)
				ClassType = ClassType.Interface;
			foreach (IReturnType rt in tp.Constraints) {
				if (FindCyclicReference (new HashSet<ITypeParameter> () { tp }, outerType, ((DomReturnType)rt).DecoratedFullName))
					continue;
				IType bt = dom.SearchType (typeParameterMember, rt);
				IReturnType resolvedType = rt;
				if (bt != null) {
					resolvedType = new DomReturnType (bt);
					if (bt.ClassType == ClassType.Interface || BaseType != null) {
						AddInterfaceImplementation (resolvedType);
					} else {
						ClassType = bt.ClassType;
						BaseType = resolvedType;
					}
				} else {
					AddInterfaceImplementation (resolvedType);
				}
			}
			if (BaseType == null)
				BaseType = DomReturnType.Object;
		}
开发者ID:nickname100,项目名称:monodevelop,代码行数:34,代码来源:InstantiatedParameterType.cs


示例4: VisitTypeParameter

			public override IType VisitTypeParameter(ITypeParameter type)
			{
				if (type.OwnerType == SymbolKind.TypeDefinition) {
					return DummyTypeParameter.GetClassTypeParameter(type.Index);
				} else {
					return base.VisitTypeParameter(type);
				}
			}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:8,代码来源:DummyTypeParameter.cs


示例5: GetBaseTypeParameter

			ITypeParameter GetBaseTypeParameter()
			{
				ITypeParameter baseTP = this.baseTypeParameter;
				if (baseTP == null) {
					// ResolveBaseTypeParameter() is idempotent, so this is thread-safe.
					this.baseTypeParameter = baseTP = ResolveBaseTypeParameter((IMethod)this.Owner, this.Index);
				}
				return baseTP;
			}
开发者ID:sphynx79,项目名称:dotfiles,代码行数:9,代码来源:MethodTypeParameterWithInheritedConstraints.cs


示例6: CheckTypeParameterConstraints

		static bool CheckTypeParameterConstraints (IType type, IEnumerable<IType> baseTypes,
				ITypeParameter typeParameter)
		{
			if (!typeParameter.DirectBaseTypes.All (t => baseTypes.Any (t2 => t2.Equals (t))))
				return false;
			if (typeParameter.HasDefaultConstructorConstraint &&
				!type.GetConstructors (c => c.IsPublic && c.Parameters.Count == 0).Any ())
				return false;
			return true;
		}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:10,代码来源:TypeCompatibilityHelper.cs


示例7: BoundTypeParameter

		public BoundTypeParameter(ITypeParameter baseTypeParameter, IClass owningClass, IMethod owningMethod)
		{
			if (owningClass == null)
				throw new ArgumentNullException("owningClass");
			if (baseTypeParameter == null)
				throw new ArgumentNullException("baseTypeParameter");
			this.baseTypeParameter = baseTypeParameter;
			this.owningMethod = owningMethod;
			this.owningClass = owningClass;
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:10,代码来源:BoundTypeParameter.cs


示例8: CheckContstraints

		void CheckContstraints(IMethod omethod, ITypeParameter p1, ITypeParameter p2, ref AbiCompatibility compatibility)
		{
			if (p1.DirectBaseTypes.Count () != p2.DirectBaseTypes.Count () ||
			    p1.HasReferenceTypeConstraint != p2.HasReferenceTypeConstraint ||
			    p1.HasValueTypeConstraint != p2.HasValueTypeConstraint ||
			    p1.HasDefaultConstructorConstraint != p2.HasDefaultConstructorConstraint) {
				OnIncompatibilityFound (new AbiEventArgs (string.Format (TranslateString ("Type parameter constraints of method {0} have changed."), omethod.FullName)));
				compatibility = AbiCompatibility.Incompatible;
			}
		}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:10,代码来源:AbiComparer.cs


示例9: AddConstraintsFromType

		static void AddConstraintsFromType(ITypeParameter tp, GenericParameter g)
		{
			foreach (TypeReference constraint in g.Constraints) {
				if (tp.Method != null) {
					tp.Constraints.Add(CreateType(tp.Class.ProjectContent, tp.Method, constraint));
				} else {
					tp.Constraints.Add(CreateType(tp.Class.ProjectContent, tp.Class, constraint));
				}
			}
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:10,代码来源:CecilReader.cs


示例10: FindUsage

		protected static bool FindUsage (BaseRefactoringContext context, SyntaxTree unit,
										 ITypeParameter typaParameter, AstNode declaration)
		{
			var found = false;
			refFinder.FindTypeParameterReferences (typaParameter, context.UnresolvedFile, unit, context.Compilation,
				(node, resolveResult) =>
				{
					found = found || node != declaration;
				}, context.CancellationToken);
			return found;
		}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:11,代码来源:TypeParameterNotUsedIssue.cs


示例11: VisitTypeParameter

		public override IType VisitTypeParameter(ITypeParameter type)
		{
			int index = type.Index;
			if (type.OwnerType == EntityType.Method) {
				if (index >= 0 && index < typeArguments.Count)
					return typeArguments[index];
				else
					return SharedTypes.UnknownType;
			} else {
				return base.VisitTypeParameter(type);
			}
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:12,代码来源:MethodTypeParameterSubstitution.cs


示例12: VisitTypeParameter

		public override IType VisitTypeParameter(ITypeParameter type)
		{
			int index = type.Index;
			if (classTypeArguments != null && type.OwnerType == EntityType.TypeDefinition) {
				if (index >= 0 && index < classTypeArguments.Count)
					return classTypeArguments[index];
				else
					return SharedTypes.UnknownType;
			} else if (methodTypeArguments != null && type.OwnerType == EntityType.Method) {
				if (index >= 0 && index < methodTypeArguments.Count)
					return methodTypeArguments[index];
				else
					return SharedTypes.UnknownType;
			} else {
				return base.VisitTypeParameter(type);
			}
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:17,代码来源:TypeParameterSubstitution.cs


示例13: ResolveTypeParameter

		public static JsExpression ResolveTypeParameter(ITypeParameter tp, ITypeDefinition currentType, IMethod currentMethod, IMetadataImporter metadataImporter, IErrorReporter errorReporter, INamer namer) {
			bool unusable = false;
			switch (tp.OwnerType) {
				case EntityType.TypeDefinition:
					unusable = metadataImporter.GetTypeSemantics(currentType).IgnoreGenericArguments;
					break;
				case EntityType.Method: {
					var sem = metadataImporter.GetMethodSemantics(currentMethod);
					unusable = sem.Type != MethodScriptSemantics.ImplType.InlineCode && metadataImporter.GetMethodSemantics(currentMethod).IgnoreGenericArguments;
					break;
				}
				default:
					errorReporter.InternalError("Invalid owner " + tp.OwnerType + " for type parameter " + tp);
					return JsExpression.Null;
			}
			if (unusable) {
				errorReporter.Message(Messages._7536, tp.Name, tp.OwnerType == EntityType.TypeDefinition ? "type" : "method", tp.OwnerType == EntityType.TypeDefinition ? currentType.FullName : currentMethod.FullName);
				return JsExpression.Null;
			}
			return JsExpression.Identifier(namer.GetTypeParameterName(tp));
		}
开发者ID:pdavis68,项目名称:SaltarelleCompiler,代码行数:21,代码来源:Utils.cs


示例14: GetTypeParameter

		static ITypeParameter GetTypeParameter(ref ITypeParameter[] typeParameters, SymbolKind symbolKind, int index)
		{
			ITypeParameter[] tps = typeParameters;
			while (index >= tps.Length) {
				// We don't have a normal type parameter for this index, so we need to extend our array.
				// Because the array can be used concurrently from multiple threads, we have to use
				// Interlocked.CompareExchange.
				ITypeParameter[] newTps = new ITypeParameter[index + 1];
				tps.CopyTo(newTps, 0);
				for (int i = tps.Length; i < newTps.Length; i++) {
					newTps[i] = new DummyTypeParameter(symbolKind, i);
				}
				ITypeParameter[] oldTps = Interlocked.CompareExchange(ref typeParameters, newTps, tps);
				if (oldTps == tps) {
					// exchange successful
					tps = newTps;
				} else {
					// exchange not successful
					tps = oldTps;
				}
			}
			return tps[index];
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:23,代码来源:DummyTypeParameter.cs


示例15: FindTypeParameterReferencesNavigator

 public FindTypeParameterReferencesNavigator(ITypeParameter typeParameter)
 {
     this.typeParameter = typeParameter;
 }
开发者ID:artifexor,项目名称:NRefactory,代码行数:4,代码来源:FindReferences.cs


示例16:

		JsExpression IRuntimeContext.ResolveTypeParameter(ITypeParameter tp) {
			return Utils.ResolveTypeParameter(tp, _typeBeingCompiled, _methodBeingCompiled, _metadataImporter, _errorReporter, _namer);
		}
开发者ID:chenxustu1,项目名称:SaltarelleCompiler,代码行数:3,代码来源:StatementCompiler.cs


示例17: ConvertTypeParameterConstraint

 Constraint ConvertTypeParameterConstraint(ITypeParameter tp)
 {
     if (!tp.HasDefaultConstructorConstraint && !tp.HasReferenceTypeConstraint && !tp.HasValueTypeConstraint && tp.DirectBaseTypes.All(IsObjectOrValueType)) {
         return null;
     }
     Constraint c = new Constraint();
     c.TypeParameter = new SimpleType (tp.Name);
     if (tp.HasReferenceTypeConstraint) {
         c.BaseTypes.Add(new PrimitiveType("class"));
     } else if (tp.HasValueTypeConstraint) {
         c.BaseTypes.Add(new PrimitiveType("struct"));
     }
     foreach (IType t in tp.DirectBaseTypes) {
         if (!IsObjectOrValueType(t))
             c.BaseTypes.Add(ConvertType(t));
     }
     if (tp.HasDefaultConstructorConstraint) {
         c.BaseTypes.Add(new PrimitiveType("new"));
     }
     return c;
 }
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:21,代码来源:TypeSystemAstBuilder.cs


示例18: ConvertTypeParameter

 TypeParameterDeclaration ConvertTypeParameter(ITypeParameter tp)
 {
     TypeParameterDeclaration decl = new TypeParameterDeclaration();
     decl.Variance = tp.Variance;
     decl.Name = tp.Name;
     return decl;
 }
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:7,代码来源:TypeSystemAstBuilder.cs


示例19: CompletionData

		ICompletionData ICompletionDataFactory.CreateVariableCompletionData(ITypeParameter parameter)
		{
			return new CompletionData(parameter.Name);
		}
开发者ID:kristjan84,项目名称:SharpDevelop,代码行数:4,代码来源:CSharpCompletionDataFactory.cs


示例20: ValidateConstraints

		internal static bool ValidateConstraints(ITypeParameter typeParameter, IType typeArgument, TypeVisitor substitution, Conversions conversions)
		{
			switch (typeArgument.Kind) { // void, null, and pointers cannot be used as type arguments
				case TypeKind.Void:
				case TypeKind.Null:
				case TypeKind.Pointer:
					return false;
			}
			if (typeParameter.HasReferenceTypeConstraint) {
				if (typeArgument.IsReferenceType != true)
					return false;
			}
			if (typeParameter.HasValueTypeConstraint) {
				if (!NullableType.IsNonNullableValueType(typeArgument))
					return false;
			}
			if (typeParameter.HasDefaultConstructorConstraint) {
				ITypeDefinition def = typeArgument.GetDefinition();
				if (def != null && def.IsAbstract)
					return false;
				var ctors = typeArgument.GetConstructors(
					m => m.Parameters.Count == 0 && m.Accessibility == Accessibility.Public,
					GetMemberOptions.IgnoreInheritedMembers | GetMemberOptions.ReturnMemberDefinitions
				);
				if (!ctors.Any())
					return false;
			}
			foreach (IType constraintType in typeParameter.DirectBaseTypes) {
				IType c = constraintType;
				if (substitution != null)
					c = c.AcceptVisitor(substitution);
				if (!conversions.IsConstraintConvertible(typeArgument, c))
					return false;
			}
			return true;
		}
开发者ID:Netring,项目名称:ILSpy,代码行数:36,代码来源:OverloadResolution.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ITypeParameterSymbol类代码示例发布时间:2022-05-24
下一篇:
C# ITypeNode类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap