Function to get type of the value entered in a textbox Just for fun, I tried creating a function that takes the value entered in a textbox, and determines the type of it. Below is the full code.

 public string GetType(string inputValue)
    {
        //Variables for the parse result
        //Can be discarded. Used because parse function mandates output variable
        int intParseResult;
        decimal decimalParseResult;
        bool boolParseResult;

        //Parse for different datatypes and check the output
        if (int.TryParse(inputValue, out intParseResult))
        {
            return typeof(int).Name;
        }
        if (decimal.TryParse(inputValue, out decimalParseResult))
        {
            return typeof(decimal).Name;
        }
        if (bool.TryParse(inputValue, out boolParseResult))
        {
            return typeof(bool).Name;
        }
        //If all parse fails, return string type.
        return typeof(string).Name;
    }


Since the text property is a string, I am trying to parse the input into different types, and returning the type name based on it. 

As of now, I see two quick issues. One is that it will need one if condition for each data type. Second is that function is creating variables and discarding them unnecessarily. 

I am looking for suggestions on how to improve this code. Again, this code is created just for fun, so no urgency. I will just like to see different possible ways to improve the code.
Here's what you can do:


Since you are not using the out var variable you can remove them altogether and use the discard character which is the underscore to just ignore them _. 
I usually prefer to use {} in ifs but this method is so short and all conditions are so similar that I'd make them one-liners.
Don't call the parameter inputValue but simply value. It might be an input outside but inside this method input has no meaning. The value can come from any source.
Don't return a string but let the user of this method do with the Type whatever he likes or call this method GetTypeName so its purpose is clear.


Example:

public Type GetType(string value)
{
    if (int.TryParse(value, out _)) return typeof(int);
    if (decimal.TryParse(value, out _)) return typeof(decimal);
    if (bool.TryParse(value, out _)) return typeof(bool);

    //If all parse fails, return string type.
    return typeof(string);
}