Checking type of parameter

c#

Solution

returntype == typeof(string)

No need to call `GetType` because you already have a type. (`GetType` would not return a useful answer anyway, it would return typeof(Type)).

Problem

I would like to check, which type a parameter of a method has, in order to give the variable I determine inside the method with the wished type: ``` public static Object getFileContent(String filename, Type returntype) { if (returntype.GetType().Equals(string)) { // do something } } ``` This doesn't work. What could I do, to check if returntype is `string` or `List<string>`?

Original source