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


C# IList.Cast方法代码示例

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


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

示例1: DropManyU

        public static short[] DropManyU(
            IVisio.Page page,
            IList<IVisio.Master> masters,
            IEnumerable<VA.Drawing.Point> points)
        {
            if (masters == null)
            {
                throw new System.ArgumentNullException("masters");
            }

            if (masters.Count < 1)
            {
                return new short[0];
            }

            if (points == null)
            {
                throw new System.ArgumentNullException("points");
            }

            // NOTE: DropMany will fail if you pass in zero items to drop
            var masters_obj_array = masters.Cast<object>().ToArray();
            var xy_array = VA.Drawing.Point.ToDoubles(points).ToArray();

            System.Array outids_sa;

            page.DropManyU(masters_obj_array, xy_array, out outids_sa);

            short[] outids = (short[])outids_sa;
            return outids;
        }
开发者ID:firestream99,项目名称:VisioAutomation,代码行数:31,代码来源:PageHelper.cs

示例2: CreateInsert

        public IList<object> CreateInsert(IList<object> list)
        {
            IList<SampleSQLData> convertedList = list.Cast<SampleSQLData>().ToList();
            IList<object> insertList = new List<object>();

            foreach (SampleSQLData sample in convertedList)
            {
                foreach (var fk in sample.FK_References)
                {
                    SampleSQLData sampleDataFiltered = convertedList.Where(l => !_tablesLoaded.ContainsKey(fk.Table) && l.Table == fk.Table).SingleOrDefault();

                    if (sampleDataFiltered != null)
                    {
                        TSQLProcessor.Execute(new CreateInsertSQL(), sampleDataFiltered, insertList);

                        _tablesLoaded.Add(fk.Table, true);
                    }
                }

                if (!_tablesLoaded.ContainsKey(sample.Table))
                {
                    TSQLProcessor.Execute(new CreateInsertSQL(), sample, insertList);

                    _tablesLoaded.Add(sample.Table, true);
                }
            }

            return insertList;
        }
开发者ID:rmattos,项目名称:Pinata,代码行数:29,代码来源:CommandSQL.cs

示例3: TransformList

		public IList TransformList(IList collection)
		{
			if (_listTransformation == null)
			{
				return collection;
			}

			IEnumerable<object> toTransform;
			if (collection.Count > 0 && collection[0] is object[])
			{
				if (((object[])collection[0]).Length != 1)
				{
					// We only expect single items
					throw new NotSupportedException();
				}

				toTransform = collection.Cast<object[]>().Select(o => o[0]);
			}
			else
			{
				toTransform = collection.Cast<object>();
			}
			object transformResult = _listTransformation.DynamicInvoke(toTransform);

			var resultList = transformResult as IList;
			return resultList ?? new List<object> { transformResult };
		}
开发者ID:khaliyo,项目名称:Spring.net-NHibernate.net-Asp.net-MVC-DWZ-,代码行数:27,代码来源:ResultTransformer.cs

示例4: SetExecReportOrders

 private void SetExecReportOrders(IList orders)
 {
     if (orders == null) return;
     ExecutionStatsGenerator.SetOrders(orders.Cast<Order>().ToList());
     var window = new ExecutionReportWindow(ExecutionStatsGenerator);
     window.Show();
 }
开发者ID:QANTau,项目名称:QPAS,代码行数:7,代码来源:OrdersPageViewModel.cs

示例5: Filter

 void IProfileSelector.FillNames(IList<string> profiles)
 {
     profileComboBox.Items.Clear();
       profileComboBox.Items.AddRange(Filter == null
     ? profiles.Cast<object>().ToArray()
     : profiles.Where(x => Filter(x)).Cast<object>().ToArray());
 }
开发者ID:aluhadora,项目名称:Caselle-Profiles,代码行数:7,代码来源:ProfileSelector.cs

示例6: CreateDelete

        public IList<object> CreateDelete(IList<object> list, IDictionary<string, string> dynamicParameters)
        {
            IList<SampleMongoData> convertedList = list.Cast<SampleMongoData>().ToList();
            IList<object> deleteList = new List<object>();

            foreach (var sample in convertedList)
            {
                IDictionary<string, IList<BsonElement>> data = new Dictionary<string, IList<BsonElement>>();
                IList<BsonElement> elementList = new List<BsonElement>();

                foreach (var row in sample.Rows)
                {
                    foreach (var key in sample.Keys)
                    {
                        Common.Schema schema = sample.Schema.SingleOrDefault(s => s.Column == key);

                        string value = JSON.DeserializeDynamic(row.ToString())[schema.Column];

                        if (dynamicParameters.ContainsKey(value))
                        {
                            value = dynamicParameters[value];
                        }

                        elementList.Add(new BsonElement(schema.Column, ParserDataType.ParseMongo((ParserDataType.DataType)Enum.Parse(typeof(ParserDataType.DataType), schema.Type, true), value)));
                    }
                }

                data.Add(sample.Collection, elementList);

                deleteList.Add(data);
            }

            return deleteList;
        }
开发者ID:rmattos,项目名称:Pinata,代码行数:34,代码来源:CommandMongo.cs

示例7: AddSongsToPlayListExecute

 private void AddSongsToPlayListExecute(IList songs)
 {
     if (songs != null)
     {
         PlayerObserver.NotifyAddToPlayList(new ObservableCollection<Song>(songs.Cast<Song>()));
     }
 }
开发者ID:QTruffart,项目名称:MonkeyMusicCloud,代码行数:7,代码来源:SongListViewModel.cs

示例8: AddToIgnoreList

 private void AddToIgnoreList(IList itemsToHide)
 {
     var items = itemsToHide.Cast<ShortcutViewModel>().ToList();
     shortcuts.RemoveAll(items);
     var entries = items.Select(shortcut => new IgnoreEntry(path: shortcut.ShortcutPath)).ToArray();
     tilesDavis.AddToIgnoreList(entries);
 }
开发者ID:gatepoet,项目名称:Deicon.TilesDavis,代码行数:7,代码来源:DetailsViewModel.cs

示例9: TransformList

        public IList TransformList(IList collection)
        {
            if (_listTransformation == null)
            {
                return collection;
            }

            object transformResult = collection;

            //if (collection.Count > 0)
            {
                if (collection.Count > 0 && collection[0] is object[])
                {
                    if ( ((object[])collection[0]).Length != 1)
                    {
                        // We only expect single items
                        throw new NotSupportedException();
                    }

                    transformResult = _listTransformation.DynamicInvoke(collection.Cast<object[]>().Select(o => o[0]));
                }
                else
                {
                    transformResult = _listTransformation.DynamicInvoke(collection);
                }
            }

            if (transformResult is IList)
            {
                return (IList) transformResult;
            }

            var list = new ArrayList {transformResult};
            return list;
        }
开发者ID:paulbatum,项目名称:nhibernate,代码行数:35,代码来源:ResultTransformer.cs

示例10: Render

 public override SqlString Render(IList args, ISessionFactoryImplementor factory)
 {
     return SqlString.Parse(
         args.Cast<object>()
             .Select(x => x.ToString())
             .ToString(x => "ISNULL(" + x + ", '')", " + ' ' + ")
     );
 }
开发者ID:chiganock,项目名称:VtecTeamFlasher,代码行数:8,代码来源:CONCAT_SMARTFunction.cs

示例11: groupByKey

 public static IList groupByKey(IList list, IList keys)
 {
     return
         list.Cast<object>().Zip(keys.Cast<object>(), (item, key) => new { item, key })
             .GroupBy(x => x.key)
             .Select(x => x.Select(y => y.item).ToList())
             .ToList();
 }
开发者ID:joespiff,项目名称:Dynamo,代码行数:8,代码来源:Sorting.cs

示例12: AddAndNotify

 private void AddAndNotify(IList items)
 {
     if (items.Count > 0)
     {
         filteredCollection.AddRange(items.Cast<object>());
         OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, items));
     }
 }
开发者ID:eslahi,项目名称:prism,代码行数:8,代码来源:ViewsCollection.Desktop.cs

示例13: Polygon

		/// <summary>
		/// Create a polygon from a list of at least 3 points with no duplicates.
		/// </summary>
		/// <param name="points">A list of unique points</param>
		public Polygon( IList<PolygonPoint> points ) {
			if (points.Count < 3) throw new ArgumentException("List has fewer than 3 points", "points");

			// Lets do one sanity check that first and last point hasn't got same position
			// Its something that often happen when importing polygon data from other formats
			if (points[0].Equals(points[points.Count - 1])) points.RemoveAt(points.Count - 1);

			_points.AddRange(points.Cast<TriangulationPoint>());
		}
开发者ID:CenzyGames,项目名称:Save-your-date-new,代码行数:13,代码来源:Polygon.cs

示例14: SetColumns

 public void SetColumns(IList<string> nameList, IList<bool> checkedList)
 {
     checkedListBox1.Items.Clear();
     checkedListBox1.Items.AddRange(nameList.Cast<object>().ToArray());
     for (int i = 0; i < checkedList.Count; i++)
     {
         checkedListBox1.SetItemChecked(i, checkedList[i]);
     }
 }
开发者ID:lgatto,项目名称:proteowizard,代码行数:9,代码来源:ColumnChooser.cs

示例15: RunUserScripts

        private void RunUserScripts(IList trades)
        {
            if (trades == null || trades.Count == 0) return;
            Parent.ScriptRunner.RunTradeScripts(trades.Cast<Trade>().ToList(), Context.Strategies.ToList(), Context.Tags.ToList(), Context);

            foreach(Trade trade in trades)
            {
                trade.TagStringUpdated();
            }
        }
开发者ID:QANTau,项目名称:QPAS,代码行数:10,代码来源:TradesPageViewModel.cs


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