Change ifdefs to be by feature, not by platform (#1146)
* First pass * Second pass * Third pass * Temporarily change build script to build only portable * Add portable features for release build * Add feature constants to build script * Add more feature constants to build script * Fix build issues * Fix build issues * Get rid of constants in build.ps1 * HAVE_NUMERICS -> HAVE_BIG_INTEGER * Remove HAVE_NULLABLE * Remove HAVE_NUMERICS from csprojs * Add missing ifdef * Add feature defines to pj * Re-enable netstd builds * Fix defines in pj * Trying to get better build outputs * Trying to get the build error * Use newer cli * Address review feedback; make netstd build work * Introduce HAVE_DB_NULL_TYPE * Adapt to upstream changes; address remaining review feedback * Adapt to upstream changes; address remaining review feedback * Rename some constants for constistency * Address review feedback * -Fixed build with signed assembly * Fix merge erorr * Address review feedback * Introduce HAVE_NON_SERIALIZED_ATTRIBUTE * HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE
This commit is contained in:
committed by
James Newton-King
parent
eb96cb9f62
commit
b8e60c773b
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40)
|
||||
#if HAVE_ASYNC
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40)
|
||||
#if HAVE_ASYNC
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endif
|
||||
@@ -156,7 +156,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
_writer.Write(chars, index, count);
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40)
|
||||
#if HAVE_ASYNC
|
||||
|
||||
public async Task EncodeAsync(byte[] buffer, int index, int count, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -30,13 +30,13 @@ using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using System.Diagnostics;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
#endif
|
||||
using System.Globalization;
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40)
|
||||
#if HAVE_METHOD_IMPL_ATTRIBUTE
|
||||
using System.Runtime.CompilerServices;
|
||||
#endif
|
||||
using Newtonsoft.Json.Serialization;
|
||||
@@ -84,7 +84,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
}
|
||||
}
|
||||
|
||||
#if (NET20 || NET35 || PORTABLE40)
|
||||
#if !HAVE_COVARIANT_GENERICS
|
||||
public static void AddRange<T>(this IList<T> initial, IEnumerable collection)
|
||||
{
|
||||
ValidationUtils.ArgumentNotNull(initial, nameof(initial));
|
||||
@@ -106,7 +106,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
if (ReflectionUtils.ImplementsGenericDefinition(type, typeof(IReadOnlyDictionary<,>)))
|
||||
{
|
||||
return true;
|
||||
@@ -357,7 +357,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
// pretty much guaranteed to be inlined, giving us fast access of that cached
|
||||
// array. With 4.5 and up we use AggressiveInlining just to be sure, so it's
|
||||
// effectively the same as calling Array.Empty<T> even when not available.
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40)
|
||||
#if HAVE_METHOD_IMPL_ATTRIBUTE
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
#endif
|
||||
public static T[] ArrayEmpty<T>()
|
||||
|
||||
@@ -28,7 +28,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Globalization;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#region License
|
||||
#region License
|
||||
// Copyright (c) 2007 James Newton-King
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
@@ -27,17 +27,17 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.ComponentModel;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using System.Reflection;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#endif
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_ADO_NET
|
||||
using System.Data.SqlTypes;
|
||||
|
||||
#endif
|
||||
@@ -135,7 +135,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{ typeof(double?), PrimitiveTypeCode.DoubleNullable },
|
||||
{ typeof(DateTime), PrimitiveTypeCode.DateTime },
|
||||
{ typeof(DateTime?), PrimitiveTypeCode.DateTimeNullable },
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
{ typeof(DateTimeOffset), PrimitiveTypeCode.DateTimeOffset },
|
||||
{ typeof(DateTimeOffset?), PrimitiveTypeCode.DateTimeOffsetNullable },
|
||||
#endif
|
||||
@@ -145,19 +145,19 @@ namespace Newtonsoft.Json.Utilities
|
||||
{ typeof(Guid?), PrimitiveTypeCode.GuidNullable },
|
||||
{ typeof(TimeSpan), PrimitiveTypeCode.TimeSpan },
|
||||
{ typeof(TimeSpan?), PrimitiveTypeCode.TimeSpanNullable },
|
||||
#if !(PORTABLE || PORTABLE40 || NET35 || NET20) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
{ typeof(BigInteger), PrimitiveTypeCode.BigInteger },
|
||||
{ typeof(BigInteger?), PrimitiveTypeCode.BigIntegerNullable },
|
||||
#endif
|
||||
{ typeof(Uri), PrimitiveTypeCode.Uri },
|
||||
{ typeof(string), PrimitiveTypeCode.String },
|
||||
{ typeof(byte[]), PrimitiveTypeCode.Bytes },
|
||||
#if !(PORTABLE || PORTABLE40 || DOTNET)
|
||||
#if HAVE_ADO_NET
|
||||
{ typeof(DBNull), PrimitiveTypeCode.DBNull }
|
||||
#endif
|
||||
};
|
||||
|
||||
#if !PORTABLE
|
||||
#if HAVE_ICONVERTIBLE
|
||||
private static readonly TypeInformation[] PrimitiveTypeCodes =
|
||||
{
|
||||
// need all of these. lookup against the index with TypeCode value
|
||||
@@ -220,7 +220,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
return PrimitiveTypeCode.Object;
|
||||
}
|
||||
|
||||
#if !PORTABLE
|
||||
#if HAVE_ICONVERTIBLE
|
||||
public static TypeInformation GetTypeInformation(IConvertible convertable)
|
||||
{
|
||||
TypeInformation typeInformation = PrimitiveTypeCodes[(int)convertable.GetTypeCode()];
|
||||
@@ -230,7 +230,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
public static bool IsConvertible(Type t)
|
||||
{
|
||||
#if !PORTABLE
|
||||
#if HAVE_ICONVERTIBLE
|
||||
return typeof(IConvertible).IsAssignableFrom(t);
|
||||
#else
|
||||
return (
|
||||
@@ -241,7 +241,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
public static TimeSpan ParseTimeSpan(string input)
|
||||
{
|
||||
#if !(NET35 || NET20)
|
||||
#if HAVE_TIME_SPAN_PARSE_WITH_CULTURE
|
||||
return TimeSpan.Parse(input, CultureInfo.InvariantCulture);
|
||||
#else
|
||||
return TimeSpan.Parse(input);
|
||||
@@ -311,7 +311,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
return o => call(null, o);
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
internal static BigInteger ToBigInteger(object value)
|
||||
{
|
||||
if (value is BigInteger)
|
||||
@@ -484,7 +484,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
return ConvertResult.Success;
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
if (initialValue is DateTime && targetType == typeof(DateTimeOffset))
|
||||
{
|
||||
value = new DateTimeOffset((DateTime)initialValue);
|
||||
@@ -546,7 +546,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
}
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
if (targetType == typeof(BigInteger))
|
||||
{
|
||||
value = ToBigInteger(initialValue);
|
||||
@@ -559,7 +559,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(PORTABLE40 || PORTABLE)
|
||||
#if HAVE_COMPONENT_MODEL
|
||||
// see if source or target types have a TypeConverter that converts between the two
|
||||
TypeConverter toConverter = GetConverter(initialType);
|
||||
|
||||
@@ -577,7 +577,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
return ConvertResult.Success;
|
||||
}
|
||||
#endif
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_ADO_NET
|
||||
// handle DBNull and INullable
|
||||
if (initialValue == DBNull.Value)
|
||||
{
|
||||
@@ -592,7 +592,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
return ConvertResult.CannotConvertNull;
|
||||
}
|
||||
#endif
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_ADO_NET
|
||||
INullable nullable = initialValue as INullable;
|
||||
if (nullable != null)
|
||||
{
|
||||
@@ -675,7 +675,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
throw new ArgumentException("Could not cast or convert from {0} to {1}.".FormatWith(CultureInfo.InvariantCulture, initialType?.ToString() ?? "{null}", targetType));
|
||||
}
|
||||
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_ADO_NET
|
||||
public static object ToValue(INullable nullableValue)
|
||||
{
|
||||
if (nullableValue == null)
|
||||
@@ -707,7 +707,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(PORTABLE40 || PORTABLE)
|
||||
#if HAVE_COMPONENT_MODEL
|
||||
internal static TypeConverter GetConverter(Type t)
|
||||
{
|
||||
return JsonTypeReflector.GetTypeConverter(t);
|
||||
@@ -716,7 +716,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
public static bool VersionTryParse(string input, out Version result)
|
||||
{
|
||||
#if !(NET20 || NET35)
|
||||
#if HAVE_VERSION_TRY_PARSE
|
||||
return Version.TryParse(input, out result);
|
||||
#else
|
||||
// improve failure performance with regex?
|
||||
@@ -1015,7 +1015,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
/// <param name="val">Mantissa</param>
|
||||
/// <param name="scale">Exponent</param>
|
||||
/// <remarks>
|
||||
/// Adoption of native function NumberToDouble() from coreclr sources,
|
||||
/// Adoption of native function NumberToDouble() from coreclr sources,
|
||||
/// see https://github.com/dotnet/coreclr/blob/master/src/classlibnative/bcltype/number.cpp#L451
|
||||
/// </remarks>
|
||||
public static double PackDouble(bool negative, ulong val, int scale)
|
||||
@@ -1265,7 +1265,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
}
|
||||
if (i == numDecimalStart)
|
||||
{
|
||||
// E follows decimal point
|
||||
// E follows decimal point
|
||||
return ParseResult.Invalid;
|
||||
}
|
||||
i++;
|
||||
@@ -1292,7 +1292,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
break;
|
||||
}
|
||||
|
||||
// parse 3 digit
|
||||
// parse 3 digit
|
||||
for (; i < end; i++)
|
||||
{
|
||||
c = chars[i];
|
||||
@@ -1367,7 +1367,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
public static bool TryConvertGuid(string s, out Guid g)
|
||||
{
|
||||
// GUID has to have format 00000000-0000-0000-0000-000000000000
|
||||
#if NET20 || NET35
|
||||
#if !HAVE_GUID_TRY_PARSE
|
||||
if (s == null)
|
||||
{
|
||||
throw new ArgumentNullException("s");
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
public static TimeSpan GetUtcOffset(this DateTime d)
|
||||
{
|
||||
#if NET20
|
||||
#if !HAVE_TIME_ZONE_INFO
|
||||
return TimeZone.CurrentTimeZone.GetUtcOffset(d);
|
||||
#else
|
||||
return TimeZoneInfo.Local.GetUtcOffset(d);
|
||||
@@ -276,7 +276,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
return true;
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
internal static bool TryParseDateTimeOffsetIso(StringReference text, out DateTimeOffset dt)
|
||||
{
|
||||
DateTimeParser dateTimeParser = new DateTimeParser();
|
||||
@@ -413,7 +413,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
return false;
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
internal static bool TryParseDateTimeOffset(StringReference s, string dateFormatString, CultureInfo culture, out DateTimeOffset dt)
|
||||
{
|
||||
if (s.Length > 0)
|
||||
@@ -564,7 +564,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
return false;
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
private static bool TryParseDateTimeOffsetMicrosoft(StringReference text, out DateTimeOffset dt)
|
||||
{
|
||||
long ticks;
|
||||
@@ -764,7 +764,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
return start;
|
||||
}
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
internal static void WriteDateTimeOffsetString(TextWriter writer, DateTimeOffset value, DateFormatHandling format, string formatString, CultureInfo culture)
|
||||
{
|
||||
if (string.IsNullOrEmpty(formatString))
|
||||
|
||||
@@ -27,7 +27,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections;
|
||||
using System.Threading;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
@@ -46,7 +46,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
private readonly IDictionary _dictionary;
|
||||
private readonly IDictionary<TKey, TValue> _genericDictionary;
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
private readonly IReadOnlyDictionary<TKey, TValue> _readOnlyDictionary;
|
||||
#endif
|
||||
private object _syncRoot;
|
||||
@@ -65,7 +65,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
_genericDictionary = dictionary;
|
||||
}
|
||||
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
public DictionaryWrapper(IReadOnlyDictionary<TKey, TValue> dictionary)
|
||||
{
|
||||
ValidationUtils.ArgumentNotNull(dictionary, nameof(dictionary));
|
||||
@@ -96,7 +96,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
return _dictionary.Contains(key);
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
return _readOnlyDictionary.ContainsKey(key);
|
||||
@@ -116,7 +116,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
return _dictionary.Keys.Cast<TKey>().ToList();
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
return _readOnlyDictionary.Keys.ToList();
|
||||
@@ -143,7 +143,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
@@ -170,7 +170,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
@@ -190,7 +190,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
return _dictionary.Values.Cast<TValue>().ToList();
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
return _readOnlyDictionary.Values.ToList();
|
||||
@@ -211,7 +211,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
return (TValue)_dictionary[key];
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
return _readOnlyDictionary[key];
|
||||
@@ -228,7 +228,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
_dictionary[key] = value;
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
@@ -247,7 +247,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
((IList)_dictionary).Add(item);
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
@@ -265,7 +265,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
_dictionary.Clear();
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
@@ -283,7 +283,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
return ((IList)_dictionary).Contains(item);
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
return _readOnlyDictionary.Contains(item);
|
||||
@@ -314,7 +314,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
(e as IDisposable)?.Dispose();
|
||||
}
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
@@ -334,7 +334,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
return _dictionary.Count;
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
return _readOnlyDictionary.Count;
|
||||
@@ -355,7 +355,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
return _dictionary.IsReadOnly;
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
return true;
|
||||
@@ -391,7 +391,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
@@ -409,7 +409,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
return _dictionary.Cast<DictionaryEntry>().Select(de => new KeyValuePair<TKey, TValue>((TKey)de.Key, (TValue)de.Value)).GetEnumerator();
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
return _readOnlyDictionary.GetEnumerator();
|
||||
@@ -432,7 +432,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
_dictionary.Add(key, value);
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
@@ -452,7 +452,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
return _dictionary[key];
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
return _readOnlyDictionary[(TKey)key];
|
||||
@@ -469,7 +469,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
_dictionary[key] = value;
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
@@ -529,7 +529,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
return _dictionary.GetEnumerator();
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
return new DictionaryEnumerator<TKey, TValue>(_readOnlyDictionary.GetEnumerator());
|
||||
@@ -547,7 +547,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
return _genericDictionary.ContainsKey((TKey)key);
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
return _readOnlyDictionary.ContainsKey((TKey)key);
|
||||
@@ -567,7 +567,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
return true;
|
||||
@@ -588,7 +588,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
return _genericDictionary.Keys.ToList();
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
return _readOnlyDictionary.Keys.ToList();
|
||||
@@ -607,7 +607,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
_dictionary.Remove(key);
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
@@ -627,7 +627,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
return _genericDictionary.Values.ToList();
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
return _readOnlyDictionary.Values.ToList();
|
||||
@@ -646,7 +646,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
_dictionary.CopyTo(array, index);
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
@@ -694,7 +694,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
return _dictionary;
|
||||
}
|
||||
#if !(NET40 || NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_READ_ONLY_COLLECTIONS
|
||||
else if (_readOnlyDictionary != null)
|
||||
{
|
||||
return _readOnlyDictionary;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_DYNAMIC
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_DYNAMIC
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(DOTNET || PORTABLE || PORTABLE40)
|
||||
#if HAVE_REFLECTION_EMIT
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#endif
|
||||
using System.Reflection;
|
||||
|
||||
@@ -23,13 +23,13 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE40)
|
||||
#if HAVE_DYNAMIC
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
#if !(PORTABLE)
|
||||
#if !HAVE_REFLECTION_BINDER
|
||||
using System.Reflection;
|
||||
#else
|
||||
using Microsoft.CSharp.RuntimeBinder;
|
||||
@@ -45,7 +45,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
{
|
||||
internal static class BinderWrapper
|
||||
{
|
||||
#if !(PORTABLE)
|
||||
#if !HAVE_REFLECTION_BINDER
|
||||
public const string CSharpAssemblyName = "Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
|
||||
|
||||
private const string BinderTypeName = "Microsoft.CSharp.RuntimeBinder.Binder, " + CSharpAssemblyName;
|
||||
@@ -114,7 +114,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
public static CallSiteBinder GetMember(string name, Type context)
|
||||
{
|
||||
#if !(PORTABLE)
|
||||
#if !HAVE_REFLECTION_BINDER
|
||||
Init();
|
||||
return (CallSiteBinder)_getMemberCall(null, 0, name, context, _getCSharpArgumentInfoArray);
|
||||
#else
|
||||
@@ -125,7 +125,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
public static CallSiteBinder SetMember(string name, Type context)
|
||||
{
|
||||
#if !(PORTABLE)
|
||||
#if !HAVE_REFLECTION_BINDER
|
||||
Init();
|
||||
return (CallSiteBinder)_setMemberCall(null, 0, name, context, _setCSharpArgumentInfoArray);
|
||||
#else
|
||||
|
||||
@@ -27,7 +27,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Runtime.Serialization;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
@@ -51,7 +51,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
string n1 = f.Name;
|
||||
string n2;
|
||||
|
||||
#if !NET20
|
||||
#if HAVE_DATA_CONTRACTS
|
||||
n2 = f.GetCustomAttributes(typeof(EnumMemberAttribute), true)
|
||||
.Cast<EnumMemberAttribute>()
|
||||
.Select(a => a.Value)
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#endregion
|
||||
|
||||
#if !(NET20 || NET35)
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20)
|
||||
#if HAVE_FSHARP_TYPES
|
||||
using System.Threading;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -112,7 +112,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
_mapType = fsharpCoreAssembly.GetType("Microsoft.FSharp.Collections.FSharpMap`2");
|
||||
|
||||
#if !(DOTNET || PORTABLE)
|
||||
#if HAVE_MEMORY_BARRIER
|
||||
Thread.MemoryBarrier();
|
||||
#endif
|
||||
_initialized = true;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(DOTNET || PORTABLE40 || PORTABLE)
|
||||
#if HAVE_REFLECTION_EMIT
|
||||
using System;
|
||||
using System.Reflection.Emit;
|
||||
using System.Reflection;
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET20 || NET35 || NET40)
|
||||
#if HAVE_IMMUTABLE_COLLECTIONS
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@@ -25,13 +25,13 @@
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40)
|
||||
#if HAVE_ASYNC
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
@@ -323,7 +323,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
return w.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static int FirstCharToEscape(string s, bool[] charEscapeFlags, StringEscapeHandling stringEscapeHandling)
|
||||
{
|
||||
for (int i = 0; i != s.Length; i++)
|
||||
@@ -356,7 +356,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40)
|
||||
#if HAVE_ASYNC
|
||||
public static Task WriteEscapedJavaScriptStringAsync(TextWriter writer, string s, char delimiter, bool appendDelimiters, bool[] charEscapeFlags, StringEscapeHandling stringEscapeHandling, JsonTextWriter client, char[] writeBuffer, CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
|
||||
@@ -27,7 +27,7 @@ using System;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using System.Reflection;
|
||||
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
|
||||
#region License, Terms and Author(s)
|
||||
//
|
||||
|
||||
@@ -28,7 +28,7 @@ using System.Globalization;
|
||||
using System.Reflection;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Globalization;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if !(PORTABLE || PORTABLE40 || NET35 || NET20) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Reflection;
|
||||
@@ -34,7 +34,7 @@ using System.Globalization;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Runtime.Serialization.Formatters;
|
||||
using System.Text;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
@@ -87,7 +87,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
static ReflectionUtils()
|
||||
{
|
||||
#if !(PORTABLE40 || PORTABLE)
|
||||
#if HAVE_EMPTY_TYPES
|
||||
EmptyTypes = Type.EmptyTypes;
|
||||
#else
|
||||
EmptyTypes = CollectionUtils.ArrayEmpty<Type>();
|
||||
@@ -1106,13 +1106,13 @@ namespace Newtonsoft.Json.Utilities
|
||||
return 0m;
|
||||
case PrimitiveTypeCode.DateTime:
|
||||
return new DateTime();
|
||||
#if !(PORTABLE || PORTABLE40 || NET35 || NET20) || NETSTANDARD1_1
|
||||
#if HAVE_BIG_INTEGER
|
||||
case PrimitiveTypeCode.BigInteger:
|
||||
return new BigInteger();
|
||||
#endif
|
||||
case PrimitiveTypeCode.Guid:
|
||||
return new Guid();
|
||||
#if !NET20
|
||||
#if HAVE_DATE_TIME_OFFSET
|
||||
case PrimitiveTypeCode.DateTimeOffset:
|
||||
return new DateTimeOffset();
|
||||
#endif
|
||||
|
||||
@@ -28,7 +28,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Globalization;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
@@ -169,7 +169,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
}
|
||||
|
||||
char c;
|
||||
#if !(DOTNET || PORTABLE)
|
||||
#if HAVE_CHAR_TO_STRING_WITH_CULTURE
|
||||
c = char.ToLower(chars[i], CultureInfo.InvariantCulture);
|
||||
#else
|
||||
c = char.ToLowerInvariant(chars[i]);
|
||||
@@ -229,7 +229,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
}
|
||||
|
||||
char c;
|
||||
#if !(DOTNET || PORTABLE)
|
||||
#if HAVE_CHAR_TO_LOWER_WITH_CULTURE
|
||||
c = char.ToLower(s[i], CultureInfo.InvariantCulture);
|
||||
#else
|
||||
c = char.ToLowerInvariant(s[i]);
|
||||
@@ -260,7 +260,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
public static bool IsHighSurrogate(char c)
|
||||
{
|
||||
#if !(PORTABLE40 || PORTABLE)
|
||||
#if HAVE_UNICODE_SURROGATE_DETECTION
|
||||
return char.IsHighSurrogate(c);
|
||||
#else
|
||||
return (c >= 55296 && c <= 56319);
|
||||
@@ -269,7 +269,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
public static bool IsLowSurrogate(char c)
|
||||
{
|
||||
#if !(PORTABLE40 || PORTABLE)
|
||||
#if HAVE_UNICODE_SURROGATE_DETECTION
|
||||
return char.IsLowSurrogate(c);
|
||||
#else
|
||||
return (c >= 56320 && c <= 57343);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#endif
|
||||
using System.Threading;
|
||||
@@ -84,7 +84,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
Dictionary<TKey, TValue> newStore = new Dictionary<TKey, TValue>(_store);
|
||||
newStore[key] = value;
|
||||
|
||||
#if !(DOTNET || PORTABLE)
|
||||
#if HAVE_MEMORY_BARRIER
|
||||
Thread.MemoryBarrier();
|
||||
#endif
|
||||
_store = newStore;
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
#if NET20
|
||||
#if !HAVE_LINQ
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
@@ -98,7 +98,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
public static MethodInfo Method(this Delegate d)
|
||||
{
|
||||
#if !(DOTNET || PORTABLE)
|
||||
#if HAVE_FULL_REFLECTION
|
||||
return d.Method;
|
||||
#else
|
||||
return d.GetMethodInfo();
|
||||
@@ -135,7 +135,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
public static bool ContainsGenericParameters(this Type type)
|
||||
{
|
||||
#if !(DOTNET || PORTABLE)
|
||||
#if HAVE_FULL_REFLECTION
|
||||
return type.ContainsGenericParameters;
|
||||
#else
|
||||
return type.GetTypeInfo().ContainsGenericParameters;
|
||||
@@ -144,7 +144,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
public static bool IsInterface(this Type type)
|
||||
{
|
||||
#if !(DOTNET || PORTABLE)
|
||||
#if HAVE_FULL_REFLECTION
|
||||
return type.IsInterface;
|
||||
#else
|
||||
return type.GetTypeInfo().IsInterface;
|
||||
@@ -153,7 +153,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
public static bool IsGenericType(this Type type)
|
||||
{
|
||||
#if !(DOTNET || PORTABLE)
|
||||
#if HAVE_FULL_REFLECTION
|
||||
return type.IsGenericType;
|
||||
#else
|
||||
return type.GetTypeInfo().IsGenericType;
|
||||
@@ -162,7 +162,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
public static bool IsGenericTypeDefinition(this Type type)
|
||||
{
|
||||
#if !(DOTNET || PORTABLE)
|
||||
#if HAVE_FULL_REFLECTION
|
||||
return type.IsGenericTypeDefinition;
|
||||
#else
|
||||
return type.GetTypeInfo().IsGenericTypeDefinition;
|
||||
@@ -171,7 +171,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
public static Type BaseType(this Type type)
|
||||
{
|
||||
#if !(DOTNET || PORTABLE)
|
||||
#if HAVE_FULL_REFLECTION
|
||||
return type.BaseType;
|
||||
#else
|
||||
return type.GetTypeInfo().BaseType;
|
||||
@@ -180,7 +180,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
public static Assembly Assembly(this Type type)
|
||||
{
|
||||
#if !(DOTNET || PORTABLE)
|
||||
#if HAVE_FULL_REFLECTION
|
||||
return type.Assembly;
|
||||
#else
|
||||
return type.GetTypeInfo().Assembly;
|
||||
@@ -189,7 +189,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
public static bool IsEnum(this Type type)
|
||||
{
|
||||
#if !(DOTNET || PORTABLE)
|
||||
#if HAVE_FULL_REFLECTION
|
||||
return type.IsEnum;
|
||||
#else
|
||||
return type.GetTypeInfo().IsEnum;
|
||||
@@ -198,7 +198,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
public static bool IsClass(this Type type)
|
||||
{
|
||||
#if !(DOTNET || PORTABLE)
|
||||
#if HAVE_FULL_REFLECTION
|
||||
return type.IsClass;
|
||||
#else
|
||||
return type.GetTypeInfo().IsClass;
|
||||
@@ -207,7 +207,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
public static bool IsSealed(this Type type)
|
||||
{
|
||||
#if !(DOTNET || PORTABLE)
|
||||
#if HAVE_FULL_REFLECTION
|
||||
return type.IsSealed;
|
||||
#else
|
||||
return type.GetTypeInfo().IsSealed;
|
||||
@@ -517,7 +517,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
public static bool IsAbstract(this Type type)
|
||||
{
|
||||
#if !(DOTNET || PORTABLE)
|
||||
#if HAVE_FULL_REFLECTION
|
||||
return type.IsAbstract;
|
||||
#else
|
||||
return type.GetTypeInfo().IsAbstract;
|
||||
@@ -526,7 +526,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
public static bool IsVisible(this Type type)
|
||||
{
|
||||
#if !(DOTNET || PORTABLE)
|
||||
#if HAVE_FULL_REFLECTION
|
||||
return type.IsVisible;
|
||||
#else
|
||||
return type.GetTypeInfo().IsVisible;
|
||||
@@ -535,7 +535,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
public static bool IsValueType(this Type type)
|
||||
{
|
||||
#if !(DOTNET || PORTABLE)
|
||||
#if HAVE_FULL_REFLECTION
|
||||
return type.IsValueType;
|
||||
#else
|
||||
return type.GetTypeInfo().IsValueType;
|
||||
@@ -544,7 +544,7 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
public static bool IsPrimitive(this Type type)
|
||||
{
|
||||
#if !(DOTNET || PORTABLE)
|
||||
#if HAVE_FULL_REFLECTION
|
||||
return type.IsPrimitive;
|
||||
#else
|
||||
return type.GetTypeInfo().IsPrimitive;
|
||||
|
||||
Reference in New Issue
Block a user