- The Problem
I want to convert a foreach loop to a linq statement.
- The Details
I have the following unity class (from metadata, removed most of the functions)
public class Transform : Component, IEnumerable
{
public IEnumerator GetEnumerator();
}
I have a local variable of this class (inherited) in my own class, which is
Transform transform;
On this I can do
List<Transform> children = new List<Transform>();
foreach (Transform t in transform)
children.Add(t);
How can I do the same in a Linq expression?