Skip to content

Commit

Permalink
Fix DeepSource CS-P1018
Browse files Browse the repository at this point in the history
# Consider using typeof(T).Assembly to get currently executing assembly CS-P1018
As the name suggests, Assembly.GetExecutingAssembly() returns the executing assembly. However, this is not an efficient way. Consider using typeof(T).Assembly instead.
  • Loading branch information
HEJOK254 committed Jul 21, 2024
1 parent 865eabe commit bf137bf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions Discord QuickEdit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AssemblyName>quickedit</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public async Task MainAsync()
private static void ShowStartMessage()
{
// https://stackoverflow.com/questions/1600962/displaying-the-build-date
var buildVer = Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "??";
var buildVer = typeof(Program).Assembly.GetName().Version?.ToString() ?? "??";
var compileTime = new DateTime(Builtin.CompileTime, DateTimeKind.Utc); // Use a different method maybe

Console.WriteLine($"\u001b[36m ---- QuickEdit ver. {buildVer} - Build Date: {compileTime.ToUniversalTime()} UTC - By HEJOK254 ---- \u001b[0m");
Expand Down

0 comments on commit bf137bf

Please sign in to comment.