public static bool TryFormat(object?value, Span <char> destination, out int charsWritten, ReadOnlySpan <char> format = default, IFormatProvider?provider = null) { if (value is null) { charsWritten = 0; return(true); } var tryFormat = _tryFormatCache.GetOrAdd(value.GetType(), CreateTryFormatDelegate); return(tryFormat(value, destination, out charsWritten, format, provider)); }
public static IEqualityComparer DefaultEqualityComparer(Type?type) { return(_equalityCache.GetOrAdd(type ?? typeof(object), GetEqualityComparerForType)); }
internal static MethodInfo GetCloneMethod(Type type) { Debug.Assert(type != null); return(_cloneMethods.GetOrAdd(type, FindCloneMethod)); }