Edit

Share via


FrameworkName Constructors

Definition

Initializes a new instance of the FrameworkName class.

Overloads

FrameworkName(String)

Initializes a new instance of the FrameworkName class from a string that contains information about a version of .NET.

FrameworkName(String, Version)

Initializes a new instance of the FrameworkName class from a string and a Version object that identify a .NET version.

FrameworkName(String, Version, String)

Initializes a new instance of the FrameworkName class from a string, a Version object that identifies a .NET version, and a profile name.

FrameworkName(String)

Source:
FrameworkName.cs
Source:
FrameworkName.cs
Source:
FrameworkName.cs

Initializes a new instance of the FrameworkName class from a string that contains information about a version of .NET.

public:
 FrameworkName(System::String ^ frameworkName);
public FrameworkName (string frameworkName);
new System.Runtime.Versioning.FrameworkName : string -> System.Runtime.Versioning.FrameworkName
Public Sub New (frameworkName As String)

Parameters

frameworkName
String

A string that contains .NET Framework version information.

Exceptions

frameworkName is Empty.

-or-

frameworkName has fewer than two components or more than three components.

-or-

frameworkName does not include a major and minor version number.

-or-

frameworkName does not include a valid version number.

frameworkName is null.

Remarks

The FrameworkName(String) constructor parses a string in the following format.

*identifier*,Version=*versionNumber*[,Profile=*profileName*]

Components in square brackets are optional. The following table describes each component.

Component Description
identifier An arbitrary string that identifies this FrameworkName instance.
versionNumber A string that represents the version of .NET, in the form [v]major.minor[.build.revision], where "v" can be either uppercase or lowercase, and the brackets denote optional elements of a version number.
profileName An arbitrary string that represents the profile of the .NET version. Typically, it is used to denote some subset of the .NET Framework, such as the .NET Compact Framework or Silverlight.

If both versionNumber and profileName are present, they can appear in any order after identifier. These strings are defined by the "Version" and "Profile" keywords, which are not case-sensitive.

The values of the identifier, versionNumber, and profileName components define the values of this FrameworkName object's properties as follows:

  • Any leading or trailing white space in the identifier component is removed and the resulting string is assigned to the Identifier property.

  • Any leading or trailing white space and the initial "v" or "V", if present, are removed from the versionNumber. The returned string is then passed to the Version.Version(String) constructor, and the resulting System.Version object is assigned to the Version property.

  • Any leading or trailing white space in the profileName component is removed and the resulting string is assigned to the Profile property.

The following are examples of valid strings that can be passed to the FrameworkName constructor:

  • .NET Framework, Version=4.0

  • .NETFramework, Version=4.0

  • .NET Framework, Version=2.0, Profile=Compact

  • .NET Framework, Version=v4.0, Profile=Compact

  • .NET Framework, Profile=Full, Version=2.0.0

Applies to

FrameworkName(String, Version)

Source:
FrameworkName.cs
Source:
FrameworkName.cs
Source:
FrameworkName.cs

Initializes a new instance of the FrameworkName class from a string and a Version object that identify a .NET version.

public:
 FrameworkName(System::String ^ identifier, Version ^ version);
public FrameworkName (string identifier, Version version);
new System.Runtime.Versioning.FrameworkName : string * Version -> System.Runtime.Versioning.FrameworkName
Public Sub New (identifier As String, version As Version)

Parameters

identifier
String

A string that identifies a .NET Framework version.

version
Version

An object that contains .NET Framework version information.

Exceptions

identifier is Empty.

identifier is null.

-or-

version is null.

Remarks

The FrameworkName class requires that a Version object include at least a major and minor version number.

Applies to

FrameworkName(String, Version, String)

Source:
FrameworkName.cs
Source:
FrameworkName.cs
Source:
FrameworkName.cs

Initializes a new instance of the FrameworkName class from a string, a Version object that identifies a .NET version, and a profile name.

public:
 FrameworkName(System::String ^ identifier, Version ^ version, System::String ^ profile);
public FrameworkName (string identifier, Version version, string profile);
public FrameworkName (string identifier, Version version, string? profile);
new System.Runtime.Versioning.FrameworkName : string * Version * string -> System.Runtime.Versioning.FrameworkName
Public Sub New (identifier As String, version As Version, profile As String)

Parameters

identifier
String

A string that identifies a .NET Framework version.

version
Version

An object that contains .NET Framework version information.

profile
String

A profile name.

Exceptions

identifier is Empty.

identifier is null.

-or-

version is null.

Remarks

The FrameworkName class requires that a Version object include at least a major and minor version number.

Applies to