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


C# Collections.Add方法代码示例

本文整理汇总了C#中Collections.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Collections.Add方法的具体用法?C# Collections.Add怎么用?C# Collections.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Collections的用法示例。


在下文中一共展示了Collections.Add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateDetailCollections

		protected virtual void UpdateDetailCollections(Collections.IContentList<DetailCollection> target, Collections.IContentList<DetailCollection> source, ContentItem targetItem)
		{
			ReplaceDetailCollectionsEnclosingItem(targetItem, source);
			

			List<string> keys = new List<string>(target.Keys);
			foreach (string key in keys)
			{
				DetailCollection detailCollection = target[key];

				if (detailCollection.Name == "TrackedLinks")
					continue;

				if (source.Keys.Contains(key))
				{
					UpdateDetails(detailCollection.Details as Collections.IContentList<ContentDetail>, source[key].Details as Collections.IContentList<ContentDetail>, targetItem);
				}
				else
					target.Remove(detailCollection);
				
			}
			
			keys = new List<string>(source.Keys);
			foreach (string key in keys)
			{
				DetailCollection detailCollection = source[key];

				if (detailCollection.Name == "TrackedLinks")
					continue;

				if (target.Keys.Contains(key) == false)
				{
					detailCollection.ID = 0;
					target.Add(detailCollection);
				}
			}

		}
开发者ID:andy4711,项目名称:n2cms,代码行数:38,代码来源:Updater.cs

示例2: Flatten

        //--------------------------------------------------------------
        /// <inheritdoc/>
        internal override void Flatten(Collections.ArrayList<Vector3F> vertices, Collections.ArrayList<int> strokeIndices, Collections.ArrayList<int> fillIndices)
        {
            _arcSegment.IsLargeArc = true;
              _arcSegment.Point1 = new Vector2F(RadiusX, 0);
              _arcSegment.Point2 = _arcSegment.Point1;
              _arcSegment.Radius = new Vector2F(RadiusX, RadiusY);
              _arcSegment.RotationAngle = 0;
              _arcSegment.SweepClockwise = false;

              var tempVertices = ResourcePools<Vector2F>.Lists.Obtain();
              _arcSegment.Flatten(tempVertices, MaxNumberOfIterations, Tolerance);

              int numberOfVertices = tempVertices.Count;
              if (numberOfVertices < 2)
            return;

              int startIndex = vertices.Count;

              // Add 3D vertices. We skip the duplicated vertices.
              for (int i = 0; i < numberOfVertices; i += 2)
            vertices.Add(new Vector3F(tempVertices[i].X, tempVertices[i].Y, 0));

              // Add stroke indices.
              for (int i = 0; i < numberOfVertices - 1; i++)
            strokeIndices.Add(startIndex + (i + 1) / 2);

              // Closing stroke:
              strokeIndices.Add(startIndex);

              if (IsFilled)
              {
            // Add a center vertex.
            var centerIndex = vertices.Count;
            vertices.Add(new Vector3F(0, 0, 0));

            // Add one triangle per circle segment.
            for (int i = 0; i < numberOfVertices / 2 - 1; i++)
            {
              fillIndices.Add(centerIndex);
              fillIndices.Add(startIndex + i + 1);
              fillIndices.Add(startIndex + i);
            }

            // Last triangle:
            fillIndices.Add(centerIndex);
            fillIndices.Add(startIndex);
            fillIndices.Add(centerIndex - 1);
              }

              ResourcePools<Vector2F>.Lists.Recycle(tempVertices);
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:53,代码来源:EllipseFigure.cs

示例3: UpdateDetails

		protected virtual void UpdateDetails(Collections.IContentList<ContentDetail> target, Collections.IContentList<ContentDetail> source, ContentItem targetItem)
		{
			ReplaceDetailsEnclosingItem(targetItem, source);
			
			List<string> keys = new List<string>(target.Keys);
			foreach (string key in keys)
			{
				
				ContentDetail detail = target[key];
				
				
				//Don't update Parent and Versionkey
				if (target[key].Name == "ParentID" || target[key].Name == "VersionKey")
					continue;

				
				//Update Values 
				if (source.Keys.Contains(key))
				{

						//Check Ignore Attribute
						var prop = targetItem.GetType().GetProperty(key);

						//Details left in db not used as property anymore check
						if (prop != null)
						{
							if (Attribute.IsDefined(prop, typeof(N2.Details.XMLUpdaterIgnoreAttribute)))
								continue;
						}

						target[key].ObjectValue = source[key].BoolValue;
						target[key].DateTimeValue = source[key].DateTimeValue;
						target[key].DoubleValue = source[key].DoubleValue;
						target[key].IntValue = source[key].IntValue;
						target[key].Meta = source[key].Meta;
						target[key].ObjectValue = source[key].ObjectValue;
						target[key].StringValue = source[key].StringValue;
						target[key].Value = source[key].Value;
				
				}
				else
				{
					target.Remove(detail);					
				}
			}

			//Add none existing Details from source
			keys = new List<string>(source.Keys);
			foreach (string key in keys)
			{
				ContentDetail detail = source[key];

				//Ignore Parent and Versionkey
				if (detail.Name == "ParentID" && detail.Name == "VersionKey")
					continue;

				if (target.Keys.Contains(key) == false)
				{
					detail.ID = 0;
					target.Add(detail);
				}
			}
		}
开发者ID:andy4711,项目名称:n2cms,代码行数:63,代码来源:Updater.cs


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