ObservableCollection SO

CSharp · Console

/Program.cs

// Example for https://stackoverflow.com/a/70270781/107625

using System;
using System.Collections.ObjectModel;
					
public class Employee
{
	public string Name { get;set; }
}

public class Program
{
	public static void Main()
	{
		var emp = new Employee{ Name = "Tom" };
		
		// Create a new instance of ObservableCollection and pass an array of 
		// Employee objects to the constructor.
		var x = new ObservableCollection<Employee>(new[] {emp});
		
		Console.WriteLine(x[0].Name);
	}
}
;