Struct DotNetRuntimeInfo
- Namespace
- AsmResolver.DotNet
- Assembly
- AsmResolver.DotNet.dll
Provides information about a target runtime.
public readonly struct DotNetRuntimeInfo : IEquatable<DotNetRuntimeInfo>
- Implements
- Inherited Members
Constructors
DotNetRuntimeInfo(string, Version)
Creates a new instance of the DotNetRuntimeInfo structure.
public DotNetRuntimeInfo(string name, Version version)
Parameters
Fields
NetCoreApp
The target framework name used by applications targeting .NET and .NET Core.
public const string NetCoreApp = ".NETCoreApp"
Field Value
NetFramework
The target framework name used by applications targeting legacy .NET Framework.
public const string NetFramework = ".NETFramework"
Field Value
NetStandard
The target framework name used by libraries targeting .NET Standard.
public const string NetStandard = ".NETStandard"
Field Value
Properties
IsNetCoreApp
Gets a value indicating whether the application targets the .NET or .NET Core runtime or not.
public bool IsNetCoreApp { get; }
Property Value
IsNetFramework
Gets a value indicating whether the application targets the .NET Framework runtime or not.
public bool IsNetFramework { get; }
Property Value
IsNetStandard
Gets a value indicating whether the application targets the .NET standard specification or not.
public bool IsNetStandard { get; }
Property Value
Name
Gets the name of the runtime.
public string Name { get; }
Property Value
Version
Gets the version of the runtime.
public Version Version { get; }
Property Value
Methods
Equals(DotNetRuntimeInfo)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(DotNetRuntimeInfo other)
Parameters
other
DotNetRuntimeInfoAn object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current instance.
Returns
- bool
true if
obj
and this instance are the same type and represent the same value; otherwise, false.
GetDefaultCorLib()
Obtains a reference to the default core lib reference of this runtime.
public AssemblyReference GetDefaultCorLib()
Returns
- AssemblyReference
The reference to the default core lib.
Exceptions
- ArgumentException
The runtime information is invalid or unsupported.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
Parse(string)
Parses the framework name as provided in a System.Runtime.Versioning.TargetFrameworkAttribute
attribute.
public static DotNetRuntimeInfo Parse(string frameworkName)
Parameters
frameworkName
stringThe full runtime name.
Returns
- DotNetRuntimeInfo
The parsed version info.
ParseMoniker(string)
Parses the target framework moniker as provided in a .runtimeconfig.json
file.
public static DotNetRuntimeInfo ParseMoniker(string moniker)
Parameters
moniker
stringThe moniker
Returns
- DotNetRuntimeInfo
The parsed version info.
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
TryParse(string, out DotNetRuntimeInfo)
Attempts to parse the framework name as provided in a System.Runtime.Versioning.TargetFrameworkAttribute
attribute.
public static bool TryParse(string frameworkName, out DotNetRuntimeInfo info)
Parameters
frameworkName
stringThe full runtime name.
info
DotNetRuntimeInfoThe parsed version info.
Returns
- bool
true
if the provided name was in the correct format,false
otherwise.
TryParseMoniker(string, out DotNetRuntimeInfo)
Attempts to parse the target framework moniker as provided in a .runtimeconfig.json
file.
public static bool TryParseMoniker(string moniker, out DotNetRuntimeInfo info)
Parameters
moniker
stringThe moniker
info
DotNetRuntimeInfoThe parsed version info.
Returns
- bool
true
if the provided name was in the correct format,false
otherwise.