public void Process <type>(type parameter) where type : class { if (parameter is CollectionClass) { Console.WriteLine("CollectionClass"); CollectionClass cls = parameter as CollectionClass; foreach (SingleClass item in cls) { item.Accept(this); } } else if (parameter is SingleClass) { SingleClass cls = parameter as SingleClass; Console.WriteLine("SingleClass (" + cls.Buffer + ")"); } }
public void AddElement(SingleClass cls) { _elements.Add(cls); }