/// <summary> /// Gets the ApiCop for the specified type. /// </summary> /// <param name="type">The type.</param> /// <returns></returns> /// <exception cref="ArgumentNullException">The <paramref name="type"/> is <c>null</c>.</exception> public static IApiCop GetApiCop(Type type) { if (!IsEnabled) { return(_dummyApiCop); } Argument.IsNotNull("type", type); lock (_cops) { if (!_cops.TryGetValue(type, out var cop)) { cop = new ApiCop(type); _cops.Add(type, cop); } return(cop); } }
/// <summary> /// Gets the ApiCop for the specified type. /// </summary> /// <param name="type">The type.</param> /// <returns></returns> /// <exception cref="ArgumentNullException">The <paramref name="type"/> is <c>null</c>.</exception> public static IApiCop GetApiCop(Type type) { if (!IsEnabled) { return(_dummyApiCop); } Argument.IsNotNull("type", type); lock (_cops) { if (!_cops.ContainsKey(type)) { var cop = new ApiCop(type); _cops.Add(type, cop); } return(_cops[type]); } }