I have an object which implements IEnumerable interface. In C#, I can use foreach to iterate all its element. However I am wondering how to determine the type in the foreach loop?
I have an object which implements IEnumerable interface. In C#, I can use foreach
Share
If you have an old style
IEnumerable(notIEnumerable<T>) you can usually call.Cast<T>or.OfType<T>to get a strongly typed one to.ForEach<T>over…If you don’t know
Tthen you can callDebug.Write(item.GetType())