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


C# CodeDom.CodeAttributeDeclarationCollection类代码示例

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


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

示例1: Constructor1_NullItem

		public void Constructor1_NullItem ()
		{
			CodeAttributeDeclaration[] declarations = new CodeAttributeDeclaration[] { 
				new CodeAttributeDeclaration (), null };

			CodeAttributeDeclarationCollection coll = new CodeAttributeDeclarationCollection (
				declarations);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:CodeAttributeDeclarationCollectionTest.cs

示例2: SetDescription

 private void SetDescription(CodeAttributeDeclarationCollection customAttributes, string description)
 {
     customAttributes.Add(
         new CodeAttributeDeclaration(
             new CodeTypeReference(DESCRIPTION_ATTR),
             new CodeAttributeArgument(
                 new CodePrimitiveExpression(description))));
 }
开发者ID:kumichou,项目名称:SpecFlow,代码行数:8,代码来源:MsTestGeneratorProvider.cs

示例3: Clone

 public static CodeAttributeDeclarationCollection Clone(this CodeAttributeDeclarationCollection collection)
 {
     if (collection == null) return null;
     CodeAttributeDeclarationCollection c = new CodeAttributeDeclarationCollection();
     foreach (CodeAttributeDeclaration attribute in collection)
         c.Add(attribute.Clone());
     return c;
 }
开发者ID:jw56578,项目名称:SpecFlowTest,代码行数:8,代码来源:CodeAttributeDeclarationCollectionExtensions.cs

示例4: Constructor0

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

示例5: Translate

 private AttributeList Translate(CodeAttributeDeclarationCollection attributes, AttributeList attributeList){
   if (attributes == null) return null;
   int n = attributes.Count;
   if (attributeList == null)
     if (n == 0) return null; else attributeList = new AttributeList(n);
   for (int i = 0; i < n; i++)
     attributeList.Add(this.Translate(attributes[i]));
   return attributeList;
 }
开发者ID:tapicer,项目名称:resource-contracts-.net,代码行数:9,代码来源:CodeDom.cs

示例6: AddMappingMetadata

		public void AddMappingMetadata (CodeAttributeDeclarationCollection metadata, XmlTypeMapping member, string ns)
		{
			if (member.Namespace != ns && member.Namespace != "") {
				CodeAttributeDeclaration ratt = new CodeAttributeDeclaration ("System.Xml.Serialization.XmlRoot");
				ratt.Arguments.Add (MapCodeGenerator.GetArg (member.ElementName));
				ratt.Arguments.Add (MapCodeGenerator.GetArg ("Namespace", member.Namespace));
				ratt.Arguments.Add (MapCodeGenerator.GetArg ("IsNullable", member.IsNullable));
				metadata.Add (ratt);
			}
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:10,代码来源:XmlCodeExporter.cs

示例7: SetProperty

 private void SetProperty(CodeAttributeDeclarationCollection customAttributes, string name, string value)
 {
     customAttributes.Add(
         new CodeAttributeDeclaration(
             new CodeTypeReference(PROPERTY_ATTR),
             new CodeAttributeArgument(
                 new CodePrimitiveExpression(name)),
             new CodeAttributeArgument(
                 new CodePrimitiveExpression(value))));
 }
开发者ID:kumichou,项目名称:SpecFlow,代码行数:10,代码来源:MsTestGeneratorProvider.cs

示例8: SetCategories

 private void SetCategories(CodeAttributeDeclarationCollection customAttributes, IEnumerable<string> categories)
 {
     foreach (var category in categories)
     {
         customAttributes.Add(
             new CodeAttributeDeclaration(
                 new CodeTypeReference(CATEGORY_ATTR),
                 new CodeAttributeArgument(
                     new CodePrimitiveExpression(category))));
     }
 }
开发者ID:kumichou,项目名称:SpecFlow,代码行数:11,代码来源:NUnitTestConverter.cs

示例9: AddRange

 public void AddRange(CodeAttributeDeclarationCollection value)
 {
     if (value == null)
     {
         throw new ArgumentNullException("value");
     }
     int count = value.Count;
     for (int i = 0; i < count; i++)
     {
         this.Add(value[i]);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:CodeAttributeDeclarationCollection.cs

示例10: AddMappingMetadata

		public void AddMappingMetadata (CodeAttributeDeclarationCollection metadata, XmlMemberMapping member, bool forceUseMemberName)
		{
			TypeData memType = member.TypeMapMember.TypeData;
			
			CodeAttributeDeclaration att = new CodeAttributeDeclaration ("System.Xml.Serialization.SoapElement");
			if (forceUseMemberName || (member.ElementName != member.MemberName))
				att.Arguments.Add (new CodeAttributeArgument (new CodePrimitiveExpression(member.ElementName)));
			if (!TypeTranslator.IsDefaultPrimitiveTpeData (memType))
				att.Arguments.Add (new CodeAttributeArgument ("DataType", new CodePrimitiveExpression(member.TypeName)));
				
			if (att.Arguments.Count > 0) 
				metadata.Add (att);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:13,代码来源:SoapCodeExporter.cs

示例11: AddIncludeMetadata

 internal static void AddIncludeMetadata(CodeAttributeDeclarationCollection metadata, StructMapping mapping, Type type)
 {
     if (!mapping.IsAnonymousType)
     {
         for (StructMapping mapping2 = mapping.DerivedMappings; mapping2 != null; mapping2 = mapping2.NextDerivedMapping)
         {
             CodeAttributeDeclaration declaration = new CodeAttributeDeclaration(type.FullName);
             declaration.Arguments.Add(new CodeAttributeArgument(new CodeTypeOfExpression(mapping2.TypeDesc.FullName)));
             metadata.Add(declaration);
             AddIncludeMetadata(metadata, mapping2, type);
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:CodeExporter.cs

示例12: Constructor1

		public void Constructor1 ()
		{
			CodeAttributeDeclaration cad1 = new CodeAttributeDeclaration ();
			CodeAttributeDeclaration cad2 = new CodeAttributeDeclaration ();

			CodeAttributeDeclaration[] declarations = new CodeAttributeDeclaration[] { cad1, cad2 };
			CodeAttributeDeclarationCollection coll = new CodeAttributeDeclarationCollection (
				declarations);

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

示例13: CreateAutoPropertyWithDataMemberAttribute

 public CodeMemberProperty CreateAutoPropertyWithDataMemberAttribute(string type, string propertyName)
 {
     var attributes = new CodeAttributeDeclarationCollection { new CodeAttributeDeclaration("DataMember") };
     var codeMemberProperty = new CodeMemberProperty
     {
         Name = propertyName,
         HasGet = true,
         HasSet = true,
         CustomAttributes = attributes,
         Attributes = MemberAttributes.Public,
         Type = new CodeTypeReference(type)
     };
     return codeMemberProperty;
 }
开发者ID:HongJunRen,项目名称:NMG,代码行数:14,代码来源:CodeGenerationHelper.cs

示例14: AddMemberMetadata

 private void AddMemberMetadata(CodeAttributeDeclarationCollection metadata, MemberMapping member, bool forceUseMemberName)
 {
     if (member.Elements.Length != 0)
     {
         ElementAccessor accessor = member.Elements[0];
         TypeMapping mapping = accessor.Mapping;
         string str = Accessor.UnescapeName(accessor.Name);
         bool flag = (str == member.Name) && !forceUseMemberName;
         if ((!flag || mapping.TypeDesc.IsAmbiguousDataType) || accessor.IsNullable)
         {
             this.AddElementMetadata(metadata, flag ? null : str, mapping.TypeDesc.IsAmbiguousDataType ? mapping.TypeDesc : null, accessor.IsNullable);
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:14,代码来源:SoapCodeExporter.cs

示例15: AddElementMetadata

 private void AddElementMetadata(CodeAttributeDeclarationCollection metadata, string elementName, TypeDesc typeDesc, bool isNullable)
 {
     CodeAttributeDeclaration declaration = new CodeAttributeDeclaration(typeof(SoapElementAttribute).FullName);
     if (elementName != null)
     {
         declaration.Arguments.Add(new CodeAttributeArgument(new CodePrimitiveExpression(elementName)));
     }
     if ((typeDesc != null) && typeDesc.IsAmbiguousDataType)
     {
         declaration.Arguments.Add(new CodeAttributeArgument("DataType", new CodePrimitiveExpression(typeDesc.DataType.Name)));
     }
     if (isNullable)
     {
         declaration.Arguments.Add(new CodeAttributeArgument("IsNullable", new CodePrimitiveExpression(true)));
     }
     metadata.Add(declaration);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:17,代码来源:SoapCodeExporter.cs


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