Skip to content

Commit

Permalink
Replace unnecessary string.Replace in ManifestBuilder.GetTypeName (#8…
Browse files Browse the repository at this point in the history
  • Loading branch information
stephentoub authored Jan 12, 2023
1 parent 05e1fe1 commit 5493c13
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5879,7 +5879,14 @@ private string GetTypeName(Type type)
if (type.IsEnum)
{
string typeName = GetTypeName(type.GetEnumUnderlyingType());
return typeName.Replace("win:Int", "win:UInt"); // ETW requires enums to be unsigned.
return typeName switch // ETW requires enums to be unsigned.
{
"win:Int8" => "win:UInt8",
"win:Int16" => "win:UInt16",
"win:Int32" => "win:UInt32",
"win:Int64" => "win:UInt64",
_ => typeName,
};
}

switch (Type.GetTypeCode(type))
Expand Down

0 comments on commit 5493c13

Please sign in to comment.