mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 12:07:05 +00:00
perf: StartsWith and EndsWith char extensions optimization
This commit is contained in:
parent
91f64a4fb1
commit
25109163fb
1 changed files with 2 additions and 2 deletions
|
|
@ -54,7 +54,7 @@ namespace ICD.Common.Utils.Extensions
|
|||
if (extends == null)
|
||||
throw new ArgumentNullException("extends");
|
||||
|
||||
return extends.StartsWith(character.ToString());
|
||||
return extends.Length > 0 && character == extends[0];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -69,7 +69,7 @@ namespace ICD.Common.Utils.Extensions
|
|||
if (extends == null)
|
||||
throw new ArgumentNullException("extends");
|
||||
|
||||
return extends.EndsWith(character.ToString());
|
||||
return extends.Length > 0 && character == extends[extends.Length - 1];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue