Avoid unnecessary intermediate Version allocation (#4349)
`Version..ctor(string)` is implemented by calling `Version.Parse`, which allocates an intermediate `Version` instance. Avoid the unnecessary intermediate allocation by using `Version.Parse` directly.
This commit is contained in:
Родитель
f23fb52ce1
Коммит
9e43252046
|
@ -100,7 +100,7 @@ namespace System
|
|||
{
|
||||
value = value.Substring(1);
|
||||
}
|
||||
Version realVersion = new Version(value);
|
||||
Version realVersion = Version.Parse(value);
|
||||
// The version class will represent some unset values as -1 internally (instead of 0).
|
||||
version = realVersion.Major * 10000;
|
||||
if (realVersion.Minor > 0)
|
||||
|
|
|
@ -748,7 +748,7 @@ namespace System.Resources
|
|||
Version ver;
|
||||
try
|
||||
{
|
||||
ver = new Version(v);
|
||||
ver = Version.Parse(v);
|
||||
}
|
||||
catch (ArgumentOutOfRangeException e)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче