summaryrefslogtreecommitdiff
path: root/src/System.Private.CoreLib/shared/System/String.cs
diff options
context:
space:
mode:
authorTarek Mahmoud Sayed <tarekms@microsoft.com>2019-02-06 15:15:46 -0800
committerGitHub <noreply@github.com>2019-02-06 15:15:46 -0800
commitfe1185343cd02559824fcbfaf69967166978e8e5 (patch)
tree84c26b6a1c1a05dcb211665a9ed8ddf339179aa6 /src/System.Private.CoreLib/shared/System/String.cs
parent17f4677cd45e2feed716d2b63046fa24a66bf662 (diff)
downloadcoreclr-fe1185343cd02559824fcbfaf69967166978e8e5.tar.gz
coreclr-fe1185343cd02559824fcbfaf69967166978e8e5.tar.bz2
coreclr-fe1185343cd02559824fcbfaf69967166978e8e5.zip
Index and Range updates (#22331)
* Index and Range updates * Address @mikedn feedback * Address Feedback * more feedback * Use Deconstruct in Range.GetOffsetAndLength * Rename GetArrayRange to GetSubArray * Temporary disable the old Corefx Range tests * Return back the TimeSpan test disabling * Fix Range jit test * Exclude the jit test * revert the changes in the jit Range test * Address Suggested Feedback
Diffstat (limited to 'src/System.Private.CoreLib/shared/System/String.cs')
-rw-r--r--src/System.Private.CoreLib/shared/System/String.cs15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/System.Private.CoreLib/shared/System/String.cs b/src/System.Private.CoreLib/shared/System/String.cs
index 0958e865db..22f830a0e4 100644
--- a/src/System.Private.CoreLib/shared/System/String.cs
+++ b/src/System.Private.CoreLib/shared/System/String.cs
@@ -444,6 +444,19 @@ namespace System
return (value == null || 0u >= (uint)value.Length) ? true : false;
}
+ [System.Runtime.CompilerServices.IndexerName("Chars")]
+ public char this[Index index]
+ {
+ get
+ {
+ int actualIndex = index.GetOffset(Length);
+ return this[actualIndex];
+ }
+ }
+
+ [System.Runtime.CompilerServices.IndexerName("Chars")]
+ public string this[Range range] => Substring(range);
+
public static bool IsNullOrWhiteSpace(string value)
{
if (value == null) return true;
@@ -672,7 +685,7 @@ namespace System
//
// IConvertible implementation
- //
+ //
public TypeCode GetTypeCode()
{