I have a problem about designing my application. I have a webservice with methods. Methods will return a encrypted binary data. Data after decrypting is a list of objects. Object can be Object1, or Object2, or Object3 which depend on called method.

I want to write only one function which return a List of object I want depend on called method. Example:

```
public static List<TKey> Generate(DataType type)
        {
            List<TKey> l = new List<TKey>();
            switch (type)
            {
                case DataType.String:
                    byte[] data = Decrypt(MyWebService.GetData1());
                    l = (List<TKey>)data;

                case DataType.Int:
                    byte[] data = Decrypt(MyWebService.GetData1());
                    l = (List<TKey>)data;
            }
            return l;
        }

```

Note: this function has error when building. I give this function so that you can understand my purpose.

My Purpose is here:

```
List<string> myString = Generate(DataType.String);
List<int> myInt = Generate(DataType.Int);

```

Thanks.