This documentation is archived and is not being maintained.

ObjectParameter Constructor (String, Type)

Initializes a new instance of the ObjectParameter class with the specified name and type.

Namespace:  System.Data.Objects
Assembly:  System.Data.Entity (in System.Data.Entity.dll)

public ObjectParameter(
	string name,
	Type type


Type: System.String
The parameter name. This name should not include the "@" parameter marker that is used in the Entity SQL statements, only the actual name. The first character of the expression must be a letter. Any successive characters in the expression must be either letters, numbers, or an underscore (_) character.
Type: System.Type
The common language runtime (CLR) type of the parameter.


If the value of either argument is null.


If the value of the name argument is invalid. Parameter names must start with a letter and can only contain letters, numbers, and underscores.

When instantiated, the parameter name cannot be changed. The parameter value can be set or changed through the Value property. After the query has been compiled, the value cannot be changed. For more information, see Query Builder Methods (Entity Framework).

.NET Framework

Supported in: 4, 3.5 SP1

.NET Framework Client Profile

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.