Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

how to cast list to observablecollection c#

var stringList = new List<string>() {"1","2","3"};
//Use the contructor override to add the list to the new collection
var obStrings = new ObservableCollection<string>(stringList);
Comment

how to add a list to observablecollection in c#

var stringList = new List<string>() {"1","2","3"};
//Use the contructor override to add the list to the new collection
var obStrings = new ObservableCollection<string>(stringList);

//If you already have a collection. Store that into a tempory list, 
//add the new range to the tempory list. Then same as above
var ob2list = obStrings.ToList();
ob2list.AddRange(stringList);
obStrings = new System.Collections.ObjectModel.ObservableCollection<string>(ob2list);
Comment

c# list to observablecollection

var lstNames = new List<string>() {"Harry", "Brandin"};
var obNames = new ObservableCollection<string>(lstNames);
Comment

PREVIOUS NEXT
Code Example
Csharp :: install active directory windows server 2019 powershell 
Csharp :: c# console.writeline 
Csharp :: c# multiple exceptions same handler 
Csharp :: c# return multiple values 
Csharp :: crud operation in asp.net 
Csharp :: c# sc create service 
Csharp :: ssml 
Csharp :: Transpose Matrix CSharp 
Csharp :: datatable in c# 
Csharp :: if else c# 
Csharp :: or operator in c# 
Csharp :: c# webclient vs httpclient 
Csharp :: overridable method C# 
Csharp :: c# quick "is" "as" 
Csharp :: jobject alternative in system.text.json 
Csharp :: unity get quaternion z 
Csharp :: c#, get a embedded resx file 
Csharp :: C# print all properties of an object including children objects 
Csharp :: function to accept interger 
Csharp :: c# Least prime factor of numbers till n 
Csharp :: unity repeat coroutine 
Csharp :: asp net mvc convert ienumerable to selectlistitem 
Csharp :: what is implicit keyword c# 
Csharp :: .net entities query multiple join condition type inference 
Csharp :: handle multiple threads c# 
Csharp :: convert enum to keyvalue 
Csharp :: c# Lucene search - build index 
Csharp :: uncapitalize string c# 
Csharp :: linq cheat sheet 
Csharp :: csharp test for null 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =