projects
/
platform
/
upstream
/
coreclr.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d014a8f
)
Module.Name: Avoid unnecessary char[] allocation (#6865)
author
Justin Van Patten
<jvp@justinvp.com>
Wed, 24 Aug 2016 03:21:45 +0000
(20:21 -0700)
committer
Jan Kotas
<jkotas@microsoft.com>
Wed, 24 Aug 2016 03:21:45 +0000
(20:21 -0700)
Instead of `new string(s.ToCharArray(), i + 1, s.Length - i - 1)`, use
the simpler `string.Substring(i + 1)` to avoid the unnecessary
intermediate char[] allocation.
src/mscorlib/src/System/Reflection/Module.cs
patch
|
blob
|
history
diff --git
a/src/mscorlib/src/System/Reflection/Module.cs
b/src/mscorlib/src/System/Reflection/Module.cs
index
6bf0ace
..
34705a4
100644
(file)
--- a/
src/mscorlib/src/System/Reflection/Module.cs
+++ b/
src/mscorlib/src/System/Reflection/Module.cs
@@
-1187,7
+1187,7
@@
namespace System.Reflection
if (i == -1)
return s;
- return
new String(s.ToCharArray(), i + 1, s.Length - i -
1);
+ return
s.Substring(i +
1);
}
}