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


C# ITypeParameter类代码示例

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


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


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