本文整理汇总了C#中BindingList.Select方法的典型用法代码示例。如果您正苦于以下问题:C# BindingList.Select方法的具体用法?C# BindingList.Select怎么用?C# BindingList.Select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BindingList
的用法示例。
在下文中一共展示了BindingList.Select方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateXmlFile
public static void CreateXmlFile(string fileName, string rootName, BindingList<string> list)
{
var array = list.Select(item => item.ToString())
.ToList();
CreateXmlFile(fileName,rootName,array);
}
示例2: Add
public void Add(BindingList<Word> input)
{
var deepCopy = input.Select(o => (Word)o.Clone()).ToList();
undoStack.Push(new BindingList<Word> (deepCopy));
redoStack.Clear();
Console.WriteLine("UndoStack: {0}\nRedoStack: {1}", UndoSize, RedoSize);
}
示例3: ListControlGridViewModel
public ListControlGridViewModel(ObservableCollection<ControlView> properties,
BindingList<IntWrappper> arrayIndexes,
Type fieldType,
ControlView baseTypeProperties
)
{
Properties = properties;
ArrayIndexes = arrayIndexes;
FieldType = fieldType;
_baseTypeProperties = baseTypeProperties;
int x = 1;
if (ArrayIndexes.Count == 1) x = 1;
else if (ArrayIndexes.Count > 1)
{
for (var i = 0; i < ArrayIndexes.Count - 1; i++)
{
x = x * ArrayIndexes[i].Int;
}
}
int y = ArrayIndexes[ArrayIndexes.Count - 1].Int;
_listOfListItemGrid = new List<List<ArrayItem>>();
int totalElementsInList = arrayIndexes.Aggregate(1, (current, iw) => current * iw.Int);
if (Properties.Count < totalElementsInList)
{
for (int i = Properties.Count; i < totalElementsInList; i++)
{
Properties.Add(Controller.DeepCopy(_baseTypeProperties));
}
}
var indexCount = 0;
List<ArrayItem> l = new List<ArrayItem>();
List<int> arrayIndexesInt = arrayIndexes.Select(o => o.Int).ToList();
for (var j = 0; j < x * y; j++)
{
if (j % y == 0)
{
l = new List<ArrayItem>();
_listOfListItemGrid.Add(l);
}
List<int> indexes = new List<int>();
for (int ir = 0; ir < arrayIndexesInt.Count; ir++)
{
TestHelper.GetArrayIndexesFromLinearIndex(arrayIndexesInt, ir, indexes, j);
}
l.Add(new ArrayItem()
{
Index = Convert.ToString(indexCount),
DisplayIndex = string.Join(",", indexes.ToArray())
});
indexCount++;
}
NotifyOfPropertyChange(() => ListOfListItemGrid);
}
示例4: PasteFillsSelection
public void PasteFillsSelection()
{
var list = new BindingList<Person>()
{
new Person {Name = "jan", Age = 25},
new Person {Name = "fon", Age = 33},
new Person {Name = "peer", Age = 25},
new Person {Name = "fo", Age = 33}
};
var tableView = new TableView {Data = list};
//select all cells in first column
tableView.SelectCells(0, 0, 3, 0);
//hook up a copy paste controller
var tableViewCopyPasteController = new TableViewPasteController(tableView);
//this should set the first column to kees,anton,kees,anton
tableViewCopyPasteController.PasteLines(new[] {"kees", "anton"});
//asert the names are now like this
Assert.AreEqual(new[] {"kees", "anton", "kees", "anton"}, list.Select(p => p.Name).ToArray());
}
示例5: CopyPasteEnumInBindingList
public void CopyPasteEnumInBindingList()
{
var list = new BindingList<ClassWithEnum>
{
new ClassWithEnum{Type = FruitType.Banaan},
new ClassWithEnum{Type = FruitType.Peer}
};
var tableView = new TableView { Data = list };
tableView.SetEnumComboboxEditor(typeof(FruitType),0);
var tableViewCopyPasteController = new TableViewPasteController(tableView);
//select 2nd row
tableView.SelectCells(1,0,1,0);
//paste twee bananen en een peer ;)
tableViewCopyPasteController.PasteLines(new[]{"Banaan","Banaan","Peer" });
//we should have 3 bananas and a pear
Assert.AreEqual("Banaan","Banaan","Banaan","Peer",list.Select(c=>c.Type).ToArray());
}
示例6: SaveList
public static void SaveList(BindingList<AForgeFunction> list, string filename)
{
File.WriteAllLines(filename, list.Select(x => x.ToString()).ToArray());
}
示例7: SpostamentoTestata
public string SpostamentoTestata(BindingList<int> idTestate, int idEsercizio, DateTime dataRegistrazione, UserInfo userinfo)
{
var windsorRep = new WindsorConfigRepository();
try
{
windsorRep.BeginTransaction(userinfo);
var message = new StringBuilder();
var movimentiService = windsorRep.GetContainer(userinfo.Azienda).Resolve<IMovimentiContabiliService>();
foreach (var singleMessage in idTestate.Select(idTestata => movimentiService.CambioEsercizio(idTestata, idEsercizio, dataRegistrazione)).Where(singleMessage => !string.IsNullOrEmpty(singleMessage)))
message.Append(singleMessage + Environment.NewLine);
windsorRep.Commit();
return message.ToString();
}
catch (Exception ex)
{
_log.ErrorFormat("Errore nello spostamento di una testata contabile - {0} - idEsercizioNuovo:{1} - dataRegistrazione:{2}", ex, Utility.GetMethodDescription(), idEsercizio, dataRegistrazione);
windsorRep.Rollback();
throw;
}
}