Hi,
I'm trying to make a function, that directly gives me a List<T> instead of the List<IMyFunctionalBlock>!
My first attempt:
where Statement not working?
I'm trying to make a function, that directly gives me a List<T> instead of the List<IMyFunctionalBlock>!
My first attempt:
Code:
public List<T> getAllBlocksOfType<T>() where T : IMyTerminalBlock { List<IMyTerminalBlock> b = new List<IMyTerminalBlock>(); GridTerminalSystem.GetBlocksOfType<T>(b); List<T> c = new List<T>(); foreach (IMyTerminalBlock a in b) if((a as T)!=null) // This should always be true, but throws an Error on "Check Code" (see below)...