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

C# AttributeCollection类代码示例

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

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



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

示例1: TestNoSiblingsFound

        public void TestNoSiblingsFound()
        {
            string namespaceUri = "namespaceUri";
              string localName = "localname";
              string qualifiedName = "qualifiedname";
              Mock<IElement> parent = null;
              IList<IElement> children = new List<IElement>();
              AttributeCollection attributes = new AttributeCollection();
              Element element = new Element(namespaceUri, localName, qualifiedName, parent as IElement, children, attributes);
              Assert.IsNull(element.PreviousSibling);
              namespaceUri = "namespaceUri";
              localName = "localname";
              qualifiedName = "qualifiedname";
              parent = new Mock<IElement>();
              children = new List<IElement>();
              attributes = new AttributeCollection();
              element = new Element(namespaceUri, localName, qualifiedName, parent as IElement, children, attributes);

              IList<IElement> parentChildren = new List<IElement>();
              parent.Setup(c => c.ChildElements).Returns(parentChildren);

              var previousSiblingStub = new Mock<IElement>();
              parentChildren.Add(element);
              Assert.IsNull(element.PreviousSibling);
        }
开发者ID:hanson-andrew,项目名称:RockSolidIoc,代码行数:25,代码来源:ElementFixture.cs


示例2: TestParse

        public void TestParse()
        {
            var saxHandler = new Mock<ISaxHandler>();

              using (System.IO.MemoryStream memoryStream = new System.IO.MemoryStream())
              {
            memoryStream.Write(new System.Text.UTF8Encoding().GetBytes(_xmlToParse), 0, _xmlToParse.Length);
            memoryStream.Position = 0;

            SaxReaderImpl saxReaderImpl = new SaxReaderImpl();
            saxReaderImpl.Parse(new System.IO.StreamReader(memoryStream), saxHandler.Object);
              }

              AttributeCollection element3Attributes = new AttributeCollection();
              Attribute attr1Attribute = new Attribute();
              attr1Attribute.LocalName = "attr1";
              attr1Attribute.QName = "attr1";
              attr1Attribute.Uri = string.Empty;
              attr1Attribute.Value = "val1";
              element3Attributes.Add("attr1", attr1Attribute);

              saxHandler.Verify(c => c.StartDocument(), Times.Exactly(1));
              saxHandler.Verify(c => c.EndDocument(), Times.Exactly(1));
              saxHandler.Verify(c => c.StartElement(string.Empty, "root", "root", new AttributeCollection()));
              saxHandler.Verify(c => c.StartElement(string.Empty, "element1", "element1", new AttributeCollection()));
              saxHandler.Verify(c => c.StartElement(string.Empty, "element2", "element2", new AttributeCollection()));
              saxHandler.Verify(c => c.StartElement(string.Empty, "element3", "element3", element3Attributes));
              saxHandler.Verify(c => c.EndElement(string.Empty, "root", "root"));
              saxHandler.Verify(c => c.EndElement(string.Empty, "element1", "element1"));
              saxHandler.Verify(c => c.EndElement(string.Empty, "element2", "element2"));
              saxHandler.Verify(c => c.EndElement(string.Empty, "element3", "element3"));
              saxHandler.Verify(c => c.Characters(It.IsAny<char[]>(), It.IsAny<int>(), It.IsAny<int>()));
        }
开发者ID:hanson-andrew,项目名称:RockSolidIoc,代码行数:33,代码来源:SaxReadersImplFixture.cs


示例3: CollectionSyncProperties

        public void CollectionSyncProperties()
        {
            AttributeCollection collection = new AttributeCollection(null);

            Assert.Null(((ICollection)collection).SyncRoot);
            Assert.False(((ICollection)collection).IsSynchronized);
        }
开发者ID:ChuangYang,项目名称:corefx,代码行数:7,代码来源:AttributeCollectionTests.cs


示例4: CreateFormatter

            public static IFormatter CreateFormatter(this ScriptScope scriptScope, string className,
                AttributeCollection attributes)
            {
                if (scriptScope.Engine.Setup.Names.Contains("Python")) return new PythonFormatter(className, attributes);

                return new RubyFormatter(className, attributes);
            }
开发者ID:mdrubin,项目名称:dynamic-script-control,代码行数:7,代码来源:ScriptConverter.cs


示例5: SimilarityDataEdge

 /// <summary>
 /// Initialzies a new instance of Berico.LinkAnalysis.Model.Edge with
 /// the provided source and target nodes.  The source and target nodes
 /// can not be null and can not be the same.
 /// </summary>
 /// <param name="initialWeight">The precalculated weight value</param>
 /// <param name="_source">The source Node for this edge</param>
 /// <param name="_target">The target Node for this edge</param>
 /// <param name="_attributes">An existing AttributeCollection instance</param> 
 public SimilarityDataEdge(double initialWeight, INode _sourceNode, INode _targetNode, AttributeCollection _attributes)
     : base(_sourceNode, _targetNode, _attributes)
 {
     // Set the initial weight.  This will be the similarity value that
     // was calculated before this edge was created
     this.weight = initialWeight;
 }
开发者ID:senfo,项目名称:snaglV2,代码行数:16,代码来源:SimilarityDataEdge.cs


示例6: importFile

        private PolicyDocumentEntity importFile(baseData vData,string title, string filepath)
        {
            AttributeCollection acoll = new AttributeCollection();
            acoll.GetMulti(AttributeFields.Name == "Literal");
            if (acoll.Count == 0)
                throw new Exception("can't find literal attribute");
            m_literalAttribute = acoll[0];

            XmlDocument doc = new XmlDocument();
            doc.Load(filepath);

            PolicyDocumentEntity pde = new PolicyDocumentEntity();
            pde.LibraryId = vData.Library.Id;
            pde.Name = title;

            PolicyLinkEntity ple = new PolicyLinkEntity();
            ple.Policy = new PolicyEntity();
            ple.Policy.LibraryId = pde.LibraryId;
            pde.PolicyLink = ple;

            XmlNode policySet = doc.SelectSingleNode("policy-set");
            if (policySet != null)
                loadPolicySet(1,title,ple,policySet);
            else
            {
                XmlNode policy = doc.SelectSingleNode("policy");
                loadPolicy(1,title,ple,policy);
            }

            pde.Save(true);

            return pde;
        }
开发者ID:habibvirji,项目名称:Webinos-Platform,代码行数:33,代码来源:importController.cs


示例7: FetchAll

 public AttributeCollection FetchAll()
 {
     AttributeCollection coll = new AttributeCollection();
     Query qry = new Query(Attribute.Schema);
     coll.LoadAndCloseReader(qry.ExecuteReader());
     return coll;
 }
开发者ID:89sos98,项目名称:dashcommerce-3,代码行数:7,代码来源:AttributeController.cs


示例8: Rule

        internal Rule( string name )
        {
            Check.IsNotNullOrWhitespace ( name, () => Name );
            Name = name;

            _attributes = new AttributeCollection ();
        }
开发者ID:divyang4481,项目名称:REM,代码行数:7,代码来源:Rule.cs


示例9: ObjectProperty

 /// <summary> 表示一个可以获取或者设置其内容的对象属性
 /// </summary>
 /// <param name="property">属性信息</param>
 public ObjectProperty(PropertyInfo property)
 {
     Field = false;
     MemberInfo = property; //属性信息
     OriginalType = property.PropertyType;
     var get = property.GetGetMethod(true); //获取属性get方法,不论是否公开
     var set = property.GetSetMethod(true); //获取属性set方法,不论是否公开
     if (set != null) //set方法不为空
     {
         CanWrite = true; //属性可写
         Static = set.IsStatic; //属性是否为静态属性
         IsPublic = set.IsPublic;
     }
     if (get != null) //get方法不为空
     {
         CanRead = true; //属性可读
         Static = get.IsStatic; //get.set只要有一个静态就是静态
         IsPublic = IsPublic || get.IsPublic;
     }
     ID = System.Threading.Interlocked.Increment(ref Literacy.Sequence);
     UID = Guid.NewGuid();
     Init();
     TypeCodes = TypeInfo.TypeCodes;
     Attributes = new AttributeCollection(MemberInfo);
     var mapping = Attributes.First<IMemberMappingAttribute>();
     if (mapping != null)
     {
         MappingName = mapping.Name;
     }
 }
开发者ID:Skycweb,项目名称:blqw-Faller,代码行数:33,代码来源:ObjectProperty.cs


示例10: TestTextlessConstructor

        public void TestTextlessConstructor()
        {
            string namespaceUri = "namespaceUri";
              string localName = "localname";
              string qualifiedName = "qualifiedname";
              var parent = new Mock<IElement>();
              List<IElement> children = new List<IElement>();
              AttributeCollection attributes = new AttributeCollection();
              Element element = new Element(namespaceUri, localName, qualifiedName, parent.Object, children, attributes);

              for (int i = 0; i < 10; i++)
              {
            children.Add(new Mock<IElement>() as IElement);
              }

              IList<IElement> parentChildren = new List<IElement>();
              parent.Setup(c => c.ChildElements).Returns(parentChildren);

              var previousSiblingStub = new Mock<IElement>();
              parentChildren.Add(previousSiblingStub.Object);
              parentChildren.Add(element);

              Assert.AreEqual(element.Attributes, attributes);
              Assert.AreEqual(element.ChildElements, children);
              Assert.AreEqual(element.FirstElement, children[0]);
              Assert.IsTrue(element.HasChildNodes);
              Assert.AreEqual(element.LastElement, children[9]);
              Assert.AreEqual(element.LocalName, localName);
              Assert.AreEqual(element.Name, qualifiedName);
              Assert.AreEqual(element.NamespaceUri, namespaceUri);
              Assert.AreEqual(element.ParentElement, parent.Object);
              Assert.AreEqual(element.PreviousSibling, previousSiblingStub.Object);
              Assert.AreEqual(element.TextContent, string.Empty);
        }
开发者ID:hanson-andrew,项目名称:RockSolidIoc,代码行数:34,代码来源:ElementFixture.cs


示例11: TestAddingExistingAttribute

        public void TestAddingExistingAttribute()
        {
            bool exceptionThrown;
            AttributeCollection attributes = new AttributeCollection();
            AttributeValue newAttributeValue = new AttributeValue("Test Value");

            // Add attribute and attribute value
            attributes.Add("Test", newAttributeValue);

            Assert.AreEqual<string>(newAttributeValue.Value, attributes["Test"].Value);

            AttributeValue existingAttributeValue = new AttributeValue("Test Value");

            try
            {
                attributes.Add("Test", existingAttributeValue);
                exceptionThrown = false;
            }
            catch (ArgumentException)
            {
                exceptionThrown = true;
            }

            Assert.IsTrue(exceptionThrown);
        }
开发者ID:senfo,项目名称:snaglV2,代码行数:25,代码来源:AttributeCollectionTests.cs


示例12: Element

        public Element(string name, string text, params IAttribute[] attributes)
        {
            this._Name = name;
            this._Attributes = new AttributeCollection(attributes);
            this._Children = new NodeCollection(new Text(text));

            
        }
开发者ID:rportela,项目名称:com.eixox.csharp.core,代码行数:8,代码来源:Element.cs


示例13: Merge

	public static AttributeCollection Merge(this AttributeCollection left, AttributeCollection right) {
		var result = new AttributeCollection {
			Base = left.Base.Merge(right.Base),
			Mult = left.Mult.Merge(right.Mult)
		};

		return result;
	}
开发者ID:dangerozov,项目名称:globalgamejam2016,代码行数:8,代码来源:AttributeCollection.cs


示例14: Apply

	public static AttributeCollection Apply(AttributeCollection attributes) {
		AttributeCollection result =  new AttributeCollection().Merge(attributes);

		foreach (var formula in _formulas) {
			result.Base [formula.Key] = result.Base.TryGetValue (formula.Key).GetValueOrDefault (0) + formula.Value (result);
		}

		return result;
	}
开发者ID:dangerozov,项目名称:globalgamejam2016,代码行数:9,代码来源:AttributeFormulas.cs


示例15: EnsureAttributes

		private void EnsureAttributes ()
		{
			if (attributes == null) {
				attrBag = new StateBag (true);
				if (IsTrackingViewState)
					attrBag.TrackViewState ();
				attributes = new AttributeCollection (attrBag);
			}
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:9,代码来源:UserControl.cs


示例16: ContainsKey_SendInDictionaryWithStringKeyAndObjectArrayValueAndCheckForKey_ReturnsTrue

		public void ContainsKey_SendInDictionaryWithStringKeyAndObjectArrayValueAndCheckForKey_ReturnsTrue() {
			var attributeValueCollection = A.CollectionOfFake<object>(1);
			var dictionary = new Hashtable();
			dictionary.Add("key", attributeValueCollection);

			var collection = new AttributeCollection(dictionary);

			Assert.IsTrue(collection.ContainsKey("key"));
		}
开发者ID:aelveborn,项目名称:njupiter,代码行数:9,代码来源:AttributeCollectionTests.cs


示例17: TestAddingAttributeWithValue

        public void TestAddingAttributeWithValue()
        {
            AttributeCollection attributes = new AttributeCollection();
            AttributeValue comparisonAttributeValue = new AttributeValue("Value");

            attributes.Add("Name", comparisonAttributeValue);

            Assert.AreEqual<string>(comparisonAttributeValue.Value, attributes["Name"].Value);
        }
开发者ID:senfo,项目名称:snaglV2,代码行数:9,代码来源:AttributeCollectionTests.cs


示例18: Index_SendInDictionaryWithStringKeyAndObjectArrayValue_IndexWithKeyContainsValue

		public void Index_SendInDictionaryWithStringKeyAndObjectArrayValue_IndexWithKeyContainsValue() {
			var attributeValueCollection = A.CollectionOfFake<object>(1);
			var dictionary = new Hashtable();
			dictionary.Add("key", attributeValueCollection);

			var collection = new AttributeCollection(dictionary);

			Assert.AreEqual(attributeValueCollection, collection["key"]);
		}
开发者ID:aelveborn,项目名称:njupiter,代码行数:9,代码来源:AttributeCollectionTests.cs


示例19: Count_SendInDictionaryWithOnePost_ReturnsOne

		public void Count_SendInDictionaryWithOnePost_ReturnsOne() {
			var attributeValueCollection = A.CollectionOfFake<object>(1);
			var dictionary = new Hashtable();
			dictionary.Add("key", attributeValueCollection);

			var collection = new AttributeCollection(dictionary);

			Assert.AreEqual(1, collection.Count);
		}
开发者ID:aelveborn,项目名称:njupiter,代码行数:9,代码来源:AttributeCollectionTests.cs


示例20: ContainsTest

        public void ContainsTest(int count)
        {
            var attributes = GetAttributes().Take(count).ToArray();
            var attributeCollection = new AttributeCollection(attributes);

            foreach (Attribute attribute in attributes)
            {
                Assert.True(attributeCollection.Contains(attribute));
            }
        }
开发者ID:ChuangYang,项目名称:corefx,代码行数:10,代码来源:AttributeCollectionTests.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# AttributeData类代码示例发布时间:2022-05-24
下一篇:
C# AttributeArgumentSyntax类代码示例发布时间: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