Imported Upstream version 5.10.0.69

Former-commit-id: fc39669a0b707dd3c063977486506b6793da2890
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-01-29 19:03:06 +00:00
parent d8f8abd549
commit e2950ec768
6283 changed files with 453847 additions and 91879 deletions

View File

@ -41,12 +41,25 @@ namespace System
{
partial class String
{
[MethodImplAttribute (MethodImplOptions.InternalCall)]
public extern String (ReadOnlySpan<char> value);
public int Length {
get {
return m_stringLength;
}
}
public unsafe static implicit operator ReadOnlySpan<char> (String value)
{
if (value == null)
return default;
fixed (void* start = &value.m_firstChar)
return new ReadOnlySpan<char> (start, value.Length);
}
internal static unsafe int CompareOrdinalUnchecked (String strA, int indexA, int lenA, String strB, int indexB, int lenB)
{
if (strA == null) {
@ -743,5 +756,17 @@ namespace System
// GetString () is called even when length == 0
return enc.GetString (bytes);
}
unsafe String CreateString (ReadOnlySpan<char> value)
{
if (value.Length == 0)
return Empty;
String result = FastAllocateString (value.Length);
fixed (char *dest = result, ptr = &value.DangerousGetPinnableReference ())
wstrcpy (dest, ptr, value.Length);
return result;
}
}
}