Google.Api.Ads.AdWords.Examples.CSharp.ExampleUtilities.GetUnderlyingType(System.Type)

Here are the examples of the csharp api class Google.Api.Ads.AdWords.Examples.CSharp.ExampleUtilities.GetUnderlyingType(System.Type) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Example 7

1. Example

Project: googleads-dotnet-lib
Source File: ExampleUtilities.cs
public static List<object> GetParameters(MethodInfo methodInfo) {
      List<object> retval = new List<object>();
      ParameterInfo[] paramInfos = methodInfo.GetParameters();
      for (int i = 1; i < paramInfos.Length; i++) {
        ParameterInfo paramInfo = paramInfos[i];

        Type underlyingType = GetUnderlyingType(paramInfo.ParameterType);
        bool isNullable = IsNullable(underlyingType);
        if (isNullable) {
          Console.Write("[Optional] ");
        }

        Console.Write("Enter {0}: ", paramInfo.Name);
        string value = Console.ReadLine();
        object objValue = null;

        TypeConverter typeConverter = TypeDescriptor.GetConverter(underlyingType);
        try {
          objValue = typeConverter.ConvertFromString(value);
        } catch {
          if (!isNullable) {
            throw;
          }
        }

        retval.Add(objValue);
      }
      return retval;
    }