CanConvert() публичный абстрактный Метод

Determines whether this instance can convert the specified object type.
public abstract CanConvert ( Type objectType ) : bool
objectType System.Type Type of the object.
Результат bool
Пример #1
0
 internal static JsonConverter GetMatchingConverter(IList <JsonConverter> converters, Type objectType)
 {
     if (converters != null)
     {
         for (int index = 0; index < converters.Count; ++index)
         {
             JsonConverter jsonConverter = converters[index];
             if (jsonConverter.CanConvert(objectType))
             {
                 return(jsonConverter);
             }
         }
     }
     return((JsonConverter)null);
 }
 internal static JsonConverter GetMatchingConverter(IList <JsonConverter> converters, Type objectType)
 {
     if (converters != null)
     {
         for (int i = 0; i < converters.Count; i++)
         {
             JsonConverter item = converters[i];
             if (item.CanConvert(objectType))
             {
                 return(item);
             }
         }
     }
     return(null);
 }
Пример #3
0
 internal static JsonConverter GetMatchingConverter(IList <JsonConverter> converters, Type objectType)
 {
     ValidationUtils.ArgumentNotNull(objectType, "objectType");
     if (converters != null)
     {
         for (int i = 0; i < converters.Count; i++)
         {
             JsonConverter jsonConverter = converters[i];
             if (jsonConverter.CanConvert(objectType))
             {
                 return(jsonConverter);
             }
         }
     }
     return(null);
 }
Пример #4
0
        private bool HasMatchingConverter(Type type, out JsonConverter matchingConverter)
        {
            if (_converters != null)
            {
                for (int i = 0; i < _converters.Count; i++)
                {
                    JsonConverter converter = _converters[i];

                    if (converter.CanConvert(type))
                    {
                        matchingConverter = converter;
                        return(true);
                    }
                }
            }

            matchingConverter = null;
            return(false);
        }
Пример #5
0
 internal static JsonConverter GetMatchingConverter([Nullable(new byte[]
 {
     2,
     1
 })] IList <JsonConverter> converters, Type objectType)
 {
     if (converters != null)
     {
         for (int i = 0; i < converters.Count; i++)
         {
             JsonConverter jsonConverter = converters[i];
             if (jsonConverter.CanConvert(objectType))
             {
                 return(jsonConverter);
             }
         }
     }
     return(null);
 }
Пример #6
0
        internal static bool HasMatchingConverter(IList <JsonConverter> converters, Type type, out JsonConverter matchingConverter)
        {
            if (converters != null)
            {
                for (int i = 0; i < converters.Count; i++)
                {
                    JsonConverter converter = converters[i];

                    if (converter.CanConvert(type))
                    {
                        matchingConverter = converter;
                        return(true);
                    }
                }
            }

            matchingConverter = null;
            return(false);
        }
Пример #7
0
        internal static JsonConverter GetMatchingConverter(IList <JsonConverter> converters, Type objectType)
        {
#if DEBUG
            ValidationUtils.ArgumentNotNull(objectType, nameof(objectType));
#endif

            if (converters != null)
            {
                for (int i = 0; i < converters.Count; i++)
                {
                    JsonConverter converter = converters[i];

                    if (converter.CanConvert(objectType))
                    {
                        return(converter);
                    }
                }
            }

            return(null);
        }
Пример #8
0
        internal static bool HasMatchingConverter(IList <JsonConverter> converters, Type objectType, out JsonConverter matchingConverter)
        {
            if (objectType == null)
            {
                throw new ArgumentNullException("objectType");
            }

            if (converters != null)
            {
                for (int i = 0; i < converters.Count; i++)
                {
                    JsonConverter converter = converters[i];

                    if (converter.CanConvert(objectType))
                    {
                        matchingConverter = converter;
                        return(true);
                    }
                }
            }

            matchingConverter = null;
            return(false);
        }