is the below a good approach to returning a safe list enumerator?
- by user200295
public class Foo{
public string Prop1 {get;set;}
public string Prop2 {get;set;}
public Foo(Foo source) {
this.Prop1 = source.Prop1;
this.Prop2 = source.Prop2;
}
}
public class Main
{
private List<Foo> items = new List<Foo>();
public IEnumerable<Foo> GetItems() {
foreach (Foo foo in items) {
yield return new Foo(foo);
}
}
}