Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions src/libraries/System.Private.CoreLib/src/System/ApplicationId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,30 +40,33 @@ public override string ToString()
{
var sb = new ValueStringBuilder(stackalloc char[128]);
sb.Append(Name);

if (Culture != null)
{
sb.Append($", culture=\"{Culture}\"");
sb.Append(", culture=\"");
sb.Append(Culture);
sb.Append('"');
}
sb.Append($", version=\"{Version}\"");

sb.Append(", version=\"");
sb.Append(Version.ToString());
sb.Append('"');

if (_publicKeyToken != null)
{
sb.Append(", publicKeyToken=\"");
EncodeHexString(_publicKeyToken, ref sb);
HexConverter.EncodeToUtf16(_publicKeyToken, sb.AppendSpan(2 * _publicKeyToken.Length), HexConverter.Casing.Upper);
sb.Append('"');
}

if (ProcessorArchitecture != null)
{
sb.Append($", processorArchitecture =\"{ProcessorArchitecture}\"");
sb.Append(", processorArchitecture =\"");
sb.Append(ProcessorArchitecture);
sb.Append('"');
}
return sb.ToString();
}

private static void EncodeHexString(byte[] sArray, ref ValueStringBuilder stringBuilder)
{
for (int i = 0; i < sArray.Length; i++)
{
HexConverter.ToCharsBuffer(sArray[i], stringBuilder.AppendSpan(2), 0, HexConverter.Casing.Upper);
}
return sb.ToString();
}

public override bool Equals([NotNullWhen(true)] object? o)
Expand Down