ViewDataDictionary.ContainsKey Method (String)

 

Determines whether the collection contains an element that has the specified key.

Namespace:   System.Web.Mvc
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)

Syntax

public bool ContainsKey(
    string key
)
public:
virtual bool ContainsKey(
    String^ key
) sealed
abstract ContainsKey : 
        key:string -> bool
override ContainsKey : 
        key:string -> bool
Public Function ContainsKey (
    key As String
) As Boolean

Parameters

  • key
    Type: System.String

    The key of the element to locate in the collection.

Return Value

Type: System.Boolean

true if the collection contains an element that has the specified key; otherwise, false.

Implements

IDictionary<TKey, TValue>.ContainsKey(TKey)

Exceptions

Exception Condition
ArgumentNullException

key is null.

See Also

ViewDataDictionary Class
System.Web.Mvc Namespace

Return to top