public static AlgorithmInfo ToInfo(this IAlgorithm alg) { CompositeAlgorithm composite = alg as CompositeAlgorithm; if (composite != null) { return(composite.ToInfo()); } AlgorithmBase algBase = alg as AlgorithmBase; if (algBase == null) { throw new Exception("Failed to derive Base implementation for IAlgorithm"); } return(algBase.ToInfo()); }