Skip to content

Commit

Permalink
Use a static constructor instead of the property initialization becau…
Browse files Browse the repository at this point in the history
…se that doesn't seem to work.
  • Loading branch information
dlemstra committed Sep 12, 2024
1 parent f428c36 commit d936238
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/Magick.NET/Helpers/Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,24 @@

namespace ImageMagick;

internal static partial class Runtime
internal static class Runtime
{
public static bool Is64Bit { get; } = Architecture is Architecture.X64 or Architecture.Arm64;
static Runtime()
{
Architecture = GetArchitecture();
Is64Bit = Architecture is Architecture.X64 or Architecture.Arm64;
IsWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
}

public static Architecture Architecture { get; } = GetArchitecture();
public static bool Is64Bit { get; }

public static bool IsWindows { get; } = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
public static Architecture Architecture { get; }

public static bool IsWindows { get; }

private static Architecture GetArchitecture()
{
var processArchitecture = RuntimeInformation.ProcessArchitecture;

return processArchitecture switch
{
Architecture.X64 or Architecture.Arm64 or Architecture.X86 => processArchitecture,
Expand Down

0 comments on commit d936238

Please sign in to comment.