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


C# CodeDom.CodeTypeParameterCollection类代码示例

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


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

示例1: Constructor0

		public void Constructor0 ()
		{
			CodeTypeParameterCollection coll = new CodeTypeParameterCollection ();
			Assert.IsFalse (((IList) coll).IsFixedSize, "#1");
			Assert.IsFalse (((IList) coll).IsReadOnly, "#2");
			Assert.AreEqual (0, coll.Count, "#3");
			Assert.IsFalse (((ICollection) coll).IsSynchronized, "#4");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:8,代码来源:CodeTypeParameterCollectionTest.cs

示例2: Constructor1_NullItem

		public void Constructor1_NullItem ()
		{
			CodeTypeParameter[] typeParams = new CodeTypeParameter[] { 
				new CodeTypeParameter (), null };

			CodeTypeParameterCollection coll = new CodeTypeParameterCollection (
				typeParams);
		}
开发者ID:Profit0004,项目名称:mono,代码行数:8,代码来源:CodeTypeParameterCollectionTest.cs

示例3: AddRange

 public void AddRange(CodeTypeParameterCollection value) {
     if (value == null) {
         throw new ArgumentNullException("value");
     }
     int currentCount = value.Count;
     for (int i = 0; i < currentCount; i = ((i) + (1))) {
         this.Add(value[i]);
     }
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:9,代码来源:codetypeparametercollection.cs

示例4: GenerateDeserializer

 internal static CodeMemberMethod GenerateDeserializer(string name, string typeName, CodeTypeParameterCollection genericTypeParams = null)
 {
     var deserializer = new CodeMemberMethod { Name = name };
     deserializer.Attributes = (deserializer.Attributes & ~MemberAttributes.AccessMask) | MemberAttributes.Public;
     deserializer.Attributes = (deserializer.Attributes & ~MemberAttributes.ScopeMask) | MemberAttributes.Static;
     deserializer.CustomAttributes.Add(new CodeAttributeDeclaration(new CodeTypeReference(typeof(DeserializerMethodAttribute), CodeTypeReferenceOptions.GlobalReference)));
     deserializer.ReturnType = new CodeTypeReference(typeof(object));
     deserializer.Parameters.Add(new CodeParameterDeclarationExpression(typeof(Type), "expected"));
     deserializer.Parameters.Add(new CodeParameterDeclarationExpression(new CodeTypeReference(typeof(BinaryTokenStreamReader), CodeTypeReferenceOptions.GlobalReference), "stream"));
     return deserializer;
 }
开发者ID:stanroze,项目名称:orleans,代码行数:11,代码来源:SerializerGenerationUtilities.cs

示例5: AddRange

		public void AddRange (CodeTypeParameterCollection value)
		{
			if (value == null) {
				throw new ArgumentNullException ("value");
			}

			int count = value.Count;
			for (int i = 0; i < count; i++) {
				Add (value[i]);
			}
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:11,代码来源:CodeTypeParameterCollection.cs

示例6: GenerateCopier

 internal static CodeMemberMethod GenerateCopier(string name, string typeName, CodeTypeParameterCollection genericTypeParams = null)
 {
     var copier = new CodeMemberMethod { Name = name };
     copier.Attributes = (copier.Attributes & ~MemberAttributes.AccessMask) | MemberAttributes.Public;
     copier.Attributes = (copier.Attributes & ~MemberAttributes.ScopeMask) | MemberAttributes.Static;
     copier.CustomAttributes.Add(new CodeAttributeDeclaration(new CodeTypeReference(typeof(CopierMethodAttribute), CodeTypeReferenceOptions.GlobalReference)));
     copier.ReturnType = new CodeTypeReference(typeof(object));
     copier.Parameters.Add(new CodeParameterDeclarationExpression(typeof(object), "original"));
     copier.Statements.Add(new CodeVariableDeclarationStatement(typeName, "input", new CodeCastExpression(typeName, new CodeArgumentReferenceExpression("original"))));
     return copier;
 }
开发者ID:stanroze,项目名称:orleans,代码行数:11,代码来源:SerializerGenerationUtilities.cs

示例7: GenerateSerializer

 internal static CodeMemberMethod GenerateSerializer(string name, string typeName, CodeTypeParameterCollection genericTypeParams = null)
 {
     var serializer = new CodeMemberMethod { Name = name };
     serializer.Attributes = (serializer.Attributes & ~MemberAttributes.AccessMask) | MemberAttributes.Public;
     serializer.Attributes = (serializer.Attributes & ~MemberAttributes.ScopeMask) | MemberAttributes.Static;
     serializer.CustomAttributes.Add(new CodeAttributeDeclaration(new CodeTypeReference(typeof(SerializerMethodAttribute), CodeTypeReferenceOptions.GlobalReference)));
     serializer.ReturnType = new CodeTypeReference(typeof(void));
     serializer.Parameters.Add(new CodeParameterDeclarationExpression(typeof(object), "original"));
     serializer.Parameters.Add(new CodeParameterDeclarationExpression(new CodeTypeReference(typeof(BinaryTokenStreamWriter), CodeTypeReferenceOptions.GlobalReference), "stream"));
     serializer.Parameters.Add(new CodeParameterDeclarationExpression(typeof(Type), "expected"));
     serializer.Statements.Add(new CodeVariableDeclarationStatement(typeName, "input", new CodeCastExpression(typeName, new CodeArgumentReferenceExpression("original"))));
     return serializer;
 }
开发者ID:stanroze,项目名称:orleans,代码行数:13,代码来源:SerializerGenerationUtilities.cs

示例8: Constructor1

		public void Constructor1 ()
		{
			CodeTypeParameter tp1 = new CodeTypeParameter ();
			CodeTypeParameter tp2 = new CodeTypeParameter ();

			CodeTypeParameter[] typeParams = new CodeTypeParameter[] { tp1, tp2 };
			CodeTypeParameterCollection coll = new CodeTypeParameterCollection (
				typeParams);

			Assert.AreEqual (2, coll.Count, "#1");
			Assert.AreEqual (0, coll.IndexOf (tp1), "#2");
			Assert.AreEqual (1, coll.IndexOf (tp2), "#3");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:13,代码来源:CodeTypeParameterCollectionTest.cs

示例9: Remove_NotInCollection

		public void Remove_NotInCollection ()
		{
			CodeTypeParameterCollection coll = new CodeTypeParameterCollection ();
			coll.Remove (new CodeTypeParameter ());
		}
开发者ID:Profit0004,项目名称:mono,代码行数:5,代码来源:CodeTypeParameterCollectionTest.cs

示例10: Remove

		public void Remove ()
		{
			CodeTypeParameter ctp1 = new CodeTypeParameter ();
			CodeTypeParameter ctp2 = new CodeTypeParameter ();

			CodeTypeParameterCollection coll = new CodeTypeParameterCollection ();
			coll.Add (ctp1);
			coll.Add (ctp2);
			Assert.AreEqual (2, coll.Count, "#1");
			Assert.AreEqual (0, coll.IndexOf (ctp1), "#2");
			Assert.AreEqual (1, coll.IndexOf (ctp2), "#3");
			coll.Remove (ctp1);
			Assert.AreEqual (1, coll.Count, "#4");
			Assert.AreEqual (-1, coll.IndexOf (ctp1), "#5");
			Assert.AreEqual (0, coll.IndexOf (ctp2), "#6");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:16,代码来源:CodeTypeParameterCollectionTest.cs

示例11: OutputTypeParameters

 private void OutputTypeParameters(CodeTypeParameterCollection typeParameters)
 {
     if (typeParameters.Count != 0)
     {
         base.Output.Write("(Of ");
         bool flag = true;
         for (int i = 0; i < typeParameters.Count; i++)
         {
             if (flag)
             {
                 flag = false;
             }
             else
             {
                 base.Output.Write(", ");
             }
             base.Output.Write(typeParameters[i].Name);
             this.OutputTypeParameterConstraints(typeParameters[i]);
         }
         base.Output.Write(')');
     }
 }
开发者ID:laymain,项目名称:CodeDomUtils,代码行数:22,代码来源:VBCodeGenerator.cs

示例12: PopulateGenericParameters

        private static void PopulateGenericParameters(IGenericParameterProvider publicType, CodeTypeParameterCollection parameters)
        {
            foreach (var parameter in publicType.GenericParameters)
            {
                if (parameter.HasCustomAttributes)
                    throw new NotImplementedException("Attributes on type parameters is not supported. And weird");

                // A little hacky. Means we get "in" and "out" prefixed on any constraints, but it's either that
                // or add it as a custom attribute, which looks even weirder
                var name = parameter.Name;
                if (parameter.IsCovariant)
                    name = "out " + name;
                if (parameter.IsContravariant)
                    name = "in " + name;

                var typeParameter = new CodeTypeParameter(name)
                {
                    HasConstructorConstraint =
                        parameter.HasDefaultConstructorConstraint && !parameter.HasNotNullableValueTypeConstraint
                };
                if (parameter.HasNotNullableValueTypeConstraint)
                    typeParameter.Constraints.Add(" struct"); // Extra space is a hack!
                if (parameter.HasReferenceTypeConstraint)
                    typeParameter.Constraints.Add(" class");
                foreach (var constraint in parameter.Constraints.Where(t => t.FullName != "System.ValueType"))
                {
                    typeParameter.Constraints.Add(CreateCodeTypeReference(constraint.GetElementType()));
                }
                parameters.Add(typeParameter);
            }
        }
开发者ID:Particular,项目名称:ServiceControl.Plugin.Nsb6.CustomChecks,代码行数:31,代码来源:PublicApiGenerator.cs

示例13: Add_Null

		public void Add_Null () {
			CodeTypeParameterCollection coll = new CodeTypeParameterCollection ();
			coll.Add ((CodeTypeParameter) null);
		}
开发者ID:Profit0004,项目名称:mono,代码行数:4,代码来源:CodeTypeParameterCollectionTest.cs

示例14: GetBasicReferenceMethod

 /// <summary>
 /// Generates a wrapper method that takes arguments of the original method.
 /// </summary>
 protected override CodeTypeMember GetBasicReferenceMethod(MethodInfo methodInfo, CodeTypeParameterCollection genericTypeParam, bool isObserver)
 {
     throw new NotImplementedException("GetBasicReferenceMethod");
 }
开发者ID:stanroze,项目名称:orleans,代码行数:7,代码来源:FSharpCodeGenerator.cs

示例15: ValidateTypeParameters

 private void ValidateTypeParameters(CodeTypeParameterCollection parameters) {
     for (int i=0; i<parameters.Count; i++) {
         ValidateTypeParameter(parameters[i]);
     }
 }
开发者ID:uQr,项目名称:referencesource,代码行数:5,代码来源:CodeValidator.cs


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