本文整理汇总了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;
}
示例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;
}
示例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());
}
示例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;
}
}