Parameter Constructors

Definition

Initializes a new instance of the Parameter class.

Overloads

Parameter()

Initializes a new default instance of the Parameter class.

Parameter(String)

Initializes a new instance of the Parameter class, using the specified name.

Parameter(Parameter)

Initializes a new instance of the Parameter class with the values of the original, specified instance.

Parameter(String, DbType)

Initializes a new instance of the Parameter class, using the specified name and database type.

Parameter(String, TypeCode)

Initializes a new instance of the Parameter class, using the specified name and type.

Parameter(String, DbType, String)

Initializes a new instance of the Parameter class, using the specified name, the specified database type, and the specified value for its DefaultValue property.

Parameter(String, TypeCode, String)

Initializes a new instance of the Parameter class, using the specified name, the specified type, and the specified string for its DefaultValue property.

Parameter()

Initializes a new default instance of the Parameter class.

C#
public Parameter();

Remarks

A Parameter object created with the Parameter() constructor is initialized with default values for all its properties. The Name property is initialized to String.Empty, the Type property is initialized to TypeCode.Object, the Direction property is initialized to Input, and the DefaultValue property is initialized to null.

Applies to

.NET Framework 4.8.1 a ďalšie verzie
Produkt Verzie
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

Parameter(String)

Initializes a new instance of the Parameter class, using the specified name.

C#
public Parameter(string name);

Parameters

name
String

The name of the parameter.

Examples

The following code example demonstrates how to call the Parameter(String) constructor from a class that extends the Parameter class to initialize the Name property of the instance. This code example is part of a larger example provided for the Parameter class overview.

C#
// The StaticParameter(string, object) constructor
// initializes the DataValue property and calls the
// Parameter(string) constructor to initialize the Name property.
public StaticParameter(string name, object value) : base(name) {
  DataValue = value;
}

Remarks

A Parameter object created with the Parameter(String) constructor is initialized with the specified name and default values for its other properties. The Type property is initialized to TypeCode.Object, the Direction property is initialized to Input, and the DefaultValue property is initialized to null.

See also

Applies to

.NET Framework 4.8.1 a ďalšie verzie
Produkt Verzie
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

Parameter(Parameter)

Initializes a new instance of the Parameter class with the values of the original, specified instance.

C#
protected Parameter(System.Web.UI.WebControls.Parameter original);

Parameters

original
Parameter

A Parameter instance from which the current instance is initialized.

Examples

The following code example demonstrates how to call the Parameter(Parameter) constructor from a class that extends the Parameter class to implement correct object cloning behavior for the class. This code example is part of a larger example provided for the Parameter class overview.

C#
// The StaticParameter copy constructor is provided to ensure that
// the state contained in the DataValue property is copied to new
// instances of the class.
protected StaticParameter(StaticParameter original) : base(original) {
  DataValue = original.DataValue;
}

// The Clone method is overridden to call the
// StaticParameter copy constructor, so that the data in
// the DataValue property is correctly transferred to the
// new instance of the StaticParameter.
protected override Parameter Clone() {
  return new StaticParameter(this);
}

Remarks

The Parameter(Parameter) constructor is a protected copy constructor used to clone a Parameter instance. The values of the Name, Type, DefaultValue, Direction, and ConvertEmptyStringToNull properties are all transferred to the new instance.

See also

Applies to

.NET Framework 4.8.1 a ďalšie verzie
Produkt Verzie
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

Parameter(String, DbType)

Initializes a new instance of the Parameter class, using the specified name and database type.

C#
public Parameter(string name, System.Data.DbType dbType);

Parameters

name
String

The name of the parameter.

dbType
DbType

The database type of the parameter.

Remarks

A Parameter object created with the Parameter(String, DbType) constructor is initialized with the specified name and dbType parameters, and with default values for other properties. The Direction property is initialized to Input, and the DefaultValue property is initialized to null.

Applies to

.NET Framework 4.8.1 a ďalšie verzie
Produkt Verzie
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

Parameter(String, TypeCode)

Initializes a new instance of the Parameter class, using the specified name and type.

C#
public Parameter(string name, TypeCode type);

Parameters

name
String

The name of the parameter.

type
TypeCode

A TypeCode that describes the type of the parameter.

Examples

The following code example demonstrates how to call the Parameter(String, TypeCode) constructor from a class that extends the Parameter class to initialize the Name and Type properties of the instance. This code example is part of a larger example provided for the Parameter class overview.

C#
// The StaticParameter(string, TypeCode, object) constructor
// initializes the DataValue property and calls the
// Parameter(string, TypeCode) constructor to initialize the Name and
// Type properties.
public StaticParameter(string name, TypeCode type, object value) : base(name, type) {
  DataValue = value;
}

Remarks

A Parameter object created with the Parameter(String, TypeCode) constructor is initialized with the specified name and type parameters, and default values for other properties. The Direction property is initialized to Input, and the DefaultValue property is initialized to null.

See also

Applies to

.NET Framework 4.8.1 a ďalšie verzie
Produkt Verzie
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

Parameter(String, DbType, String)

Initializes a new instance of the Parameter class, using the specified name, the specified database type, and the specified value for its DefaultValue property.

C#
public Parameter(string name, System.Data.DbType dbType, string defaultValue);

Parameters

name
String

The name of the Parameter instance.

dbType
DbType

The database type of the Parameter instance.

defaultValue
String

The default value for the Parameter instance, if the Parameter is bound to a value that is not yet initialized when Evaluate(HttpContext, Control) is called.

Remarks

The Direction property of the Parameter instance is initialized to Input.

Applies to

.NET Framework 4.8.1 a ďalšie verzie
Produkt Verzie
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

Parameter(String, TypeCode, String)

Initializes a new instance of the Parameter class, using the specified name, the specified type, and the specified string for its DefaultValue property.

C#
public Parameter(string name, TypeCode type, string defaultValue);

Parameters

name
String

The name of the parameter.

type
TypeCode

A TypeCode that describes the type of the parameter.

defaultValue
String

A string that serves as a default value for the parameter, if the Parameter is bound to a value that is not yet initialized when Evaluate(HttpContext, Control) is called.

Remarks

A Parameter object created with the Parameter(String, TypeCode, String) constructor is initialized with the specified name parameter and type parameter, and assigned a DefaultValue property value. The Direction property is initialized to Input.

See also

Applies to

.NET Framework 4.8.1 a ďalšie verzie
Produkt Verzie
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1