Q: How to find type of datatype stored in string I have extracted input and output parameters from wsdl and stored in string.
example: string type=parameterType.
output: type="int".
Now, I want to get the default value of this type (in this case int).
I have tried this: type.GetType(). Result is the type of the class String, however, I want the value's type.
This is so I can get the default value of the actual value's type, not the default value of string e.g. int ==> 0 and not "int" ==> string ==> null.

A: If the format is always same(first type then value)you can use String.Split to extract type as string and then you can do if(typeString == "int") then from string to int int x = int.Parse(valueString); Hope that gives you an idea to do it.

A: Given the name of the type, you need to use reflection to find the actual type, then get its default value. However, since the type name for int is System.Int32, you'll need to go through a dictionary, e.g.:
var dictionary = new Dictionary<string, string>
{
    {"int", "System.Int32"},
};

var typeName = "int";
if (dictionary.ContainsKey(typeName))
    typeName = dictionary[typeName];
var type = Type.GetType(typeName);

var defaultValue = type.IsValueType ? Activator.CreateInstance(type) : null;

