From: Mandar Sahasrabuddhe Date: Sat, 25 Mar 2017 01:21:56 +0000 (+0530) Subject: CoreFx 14486 Remove argument validation in DangerousCreate (#10462) X-Git-Tag: accepted/tizen/base/20180629.140029~1721 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7e5aef990eb4c8d7b34fc5f8a9a1fd5ed326410d;p=platform%2Fupstream%2Fcoreclr.git CoreFx 14486 Remove argument validation in DangerousCreate (#10462) --- diff --git a/src/mscorlib/src/System/ReadOnlySpan.cs b/src/mscorlib/src/System/ReadOnlySpan.cs index ccbca3c..72754d7 100644 --- a/src/mscorlib/src/System/ReadOnlySpan.cs +++ b/src/mscorlib/src/System/ReadOnlySpan.cs @@ -120,22 +120,8 @@ namespace System /// The managed object that contains the data to span over. /// A reference to data within that object. /// The number of elements the memory contains. - /// - /// Thrown when the specified object is null. - /// - /// - /// Thrown when the specified is negative. - /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static ReadOnlySpan DangerousCreate(object obj, ref T objectData, int length) - { - if (obj == null) - ThrowHelper.ThrowArgumentNullException(ExceptionArgument.obj); - if (length < 0) - ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.length); - - return new ReadOnlySpan(ref objectData, length); - } + public static ReadOnlySpan DangerousCreate(object obj, ref T objectData, int length) => new ReadOnlySpan(ref objectData, length); // Constructor for internal use only. [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/mscorlib/src/System/Span.cs b/src/mscorlib/src/System/Span.cs index e730582..e6620f8 100644 --- a/src/mscorlib/src/System/Span.cs +++ b/src/mscorlib/src/System/Span.cs @@ -137,22 +137,8 @@ namespace System /// The managed object that contains the data to span over. /// A reference to data within that object. /// The number of elements the memory contains. - /// - /// Thrown when the specified object is null. - /// - /// - /// Thrown when the specified is negative. - /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Span DangerousCreate(object obj, ref T objectData, int length) - { - if (obj == null) - ThrowHelper.ThrowArgumentNullException(ExceptionArgument.obj); - if (length < 0) - ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.length); - - return new Span(ref objectData, length); - } + public static Span DangerousCreate(object obj, ref T objectData, int length) => new Span(ref objectData, length); // Constructor for internal use only. [MethodImpl(MethodImplOptions.AggressiveInlining)]