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


C# List.Remove方法代码示例

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


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

示例1: getAllDataBases

        public override List<string> getAllDataBases()
        {
            connect();
            DataTable databases = null;

            try
            {
                using (sqlConnection)
                {
                    sqlConnection.Open();
                    databases = sqlConnection.GetSchema("Databases");
                    sqlConnection.Close();
                }
            }
            catch (SqlException ex)
            {
                System.Windows.MessageBox.Show(ex.ToString());
            }

            List<string> data = new List<string>();
            if (databases != null)
            {
                foreach (DataRow row in databases.Rows)
                {
                    data.Add(row.ItemArray[0].ToString());
                }
            }

            data.Remove("master");
            data.Remove("model");
            data.Remove("msdb");
            data.Remove("tempdb");

            return data;
        }
开发者ID:seth-list,项目名称:MySQL_MSSQL_csharp,代码行数:35,代码来源:SQL.cs

示例2: _Pop

        /// <summary>
        /// Back, pop_back
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        private static IUndoRedoCommand _Pop(List<IUndoRedoCommand> list)
        {
            // 最後に追加したコマンドの取得
            var command = list.Last();
            // コマンドをリストから削除
            list.Remove(command);

            return command;
        }
开发者ID:jg-maon,项目名称:gpeWPF,代码行数:14,代码来源:UndoRedoManager.cs

示例3: _PushAndPopFront

 /// <summary>
 /// push_back, pop_front
 /// </summary>
 /// <param name="list"></param>
 /// <param name="command"></param>
 private static void _PushAndPopFront(List<IUndoRedoCommand> list, IUndoRedoCommand command)
 {
     // 最後にコマンドを追加
     list.Add(command);
     // 最初のコマンドを削除
     list.Remove(list.First());
 }
开发者ID:jg-maon,项目名称:gpeWPF,代码行数:12,代码来源:UndoRedoManager.cs

示例4: selectedCellsChangedHandler

        private void selectedCellsChangedHandler(object param = null)
        {
            IEnumerable<object> selected = param as IEnumerable<object>;
            var selectedDataItems = selected.Cast<DataItemViewModel>().ToList();

            // Clone the SelectedEntries
            List<DataItemViewModel> clonedSelectedEntries = new List<DataItemViewModel>(selectedDataItems);

            // keep the previous entry that is part of the selection
            DataItemViewModel previousSelectedItem = null;

            // Keep the previous entry that is in the list
            DataItemViewModel previousItem = null;

            // build list backwards so that diffs happen in order going up
            int viewCount = Data.Count;
            for (int i = viewCount - 1; i >= 0; i--)
            {
                // Get current item in the list
                var currentItem = Data[i] as DataItemViewModel;

                // If the item is part of the selection we will want some kind of diff
                if (clonedSelectedEntries.Contains(currentItem))
                {
                    // If the previous selected item is null
                    // this means that it is the bottom most item in the selection
                    // and compare it to the previous non selected string
                    if (previousSelectedItem != null)
                    {
                        currentItem.PrevName = previousSelectedItem.Name;
                        currentItem.IsVisualDiffVisible = true;
                    }
                    else if (previousItem != null) // if there is a previous selected item compare the item with that one
                    {
                        currentItem.PrevName = previousItem.Name;
                        currentItem.IsVisualDiffVisible = true;
                    }
                    else //the selected item is the bottom item with nothing else to compare, so just show differences from an empty string
                    {
                        currentItem.PrevName = String.Empty;
                        currentItem.IsVisualDiffVisible = true;
                    }

                    // Set the previously selected item to the current item to keep for comparison with the next selected item on the way up
                    previousSelectedItem = currentItem;

                    // clean up
                    clonedSelectedEntries.Remove(currentItem);
                }
                else // if item is not part of the selection we will want the original text
                {
                    currentItem.PrevName = String.Empty;
                    currentItem.IsVisualDiffVisible = false;
                }

                // regardless of whether item is in selection or not we keep it as the previous item when we move up to the next one
                previousItem = currentItem;
            }
        }
开发者ID:yg2522,项目名称:Grid-Test-Project,代码行数:59,代码来源:MainWindowViewModel.cs


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