/// <summary>Try and get the API scalar type by CLR type.</summary> /// <typeparam name="TScalar">CLR type to lookup the API scalar type by.</typeparam> /// <param name="apiScalarType">The API scalar type if it exists in the API schema, null otherwise.</param> /// <returns>True if API scalar type exists in the API schema, false otherwise.</returns> public static bool TryGetApiScalarType <TScalar>(this IApiSchema apiSchema, out IApiScalarType apiScalarType) { Contract.Requires(apiSchema != null); var clrType = typeof(TScalar); return(apiSchema.TryGetApiScalarType(clrType, out apiScalarType)); }
public bool TryGetApiScalarType(Type clrType, out IApiScalarType apiScalarType) { if (clrType != null) { return(this.ClrTypeToApiScalarTypeDictionary.TryGetValue(clrType, out apiScalarType)); } apiScalarType = null; return(false); }
public bool TryGetApiScalarType(string apiName, out IApiScalarType apiScalarType) { if (!String.IsNullOrWhiteSpace(apiName)) { return(this.ApiNameToApiScalarTypeDictionary.TryGetValue(apiName, out apiScalarType)); } apiScalarType = null; return(false); }
public TryGetApiScalarTypeWithApiTypeUnitTest(string name, IApiSchema apiSchema, string apiType, IApiScalarType expectedApiScalarType) : base(name) { this.ApiSchema = apiSchema; this.ApiType = apiType; this.ExpectedApiScalarType = expectedApiScalarType; }