本文整理汇总了C#中ObservableList.Select方法的典型用法代码示例。如果您正苦于以下问题:C# ObservableList.Select方法的具体用法?C# ObservableList.Select怎么用?C# ObservableList.Select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObservableList
的用法示例。
在下文中一共展示了ObservableList.Select方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WordListsVarietyMeaningViewModel
public WordListsVarietyMeaningViewModel(IBusyService busyService, IAnalysisService analysisService, WordViewModel.Factory wordFactory, WordListsVarietyViewModel variety, Meaning meaning)
: base(meaning)
{
_busyService = busyService;
_analysisService = analysisService;
_variety = variety;
_domainWords = new ObservableList<Word>(variety.DomainVariety.Words[meaning]);
_words = new MirroredBindableList<Word, WordViewModel>(_domainWords, word => wordFactory(word), vm => vm.DomainWord);
_domainWords.CollectionChanged += DomainWordsChanged;
_strRep = string.Join(",", _domainWords.Select(word => word.StrRep));
_showInVarietiesCommand = new RelayCommand(ShowInVarieties, () => _domainWords.Count > 0);
}
示例2: TestEnumAddsDependancy
public void TestEnumAddsDependancy()
{
var list = new ObservableList<int>(1, 2, 3, 4, 5, 6);
var computed = new ComputedObservable<double[]>(() => list.Select(i => Math.Pow(i, 2)).ToArray())
{
Name = "ComputedVal"
};
CollectionAssert.AreEquivalent(new[] {1.0, 4.0, 9.0, 16.0, 25.0, 36.0}, computed.Value);
Assert.AreEqual(1, computed.DependencyCount);
list[1] = 10;
CollectionAssert.AreEquivalent(new[] {1.0, 100.0, 9.0, 16.0, 25.0, 36.0}, computed.Value);
list.Add(100);
CollectionAssert.Contains(computed.Value, 10000.0);
}