ViewDataDictionary.Remove Method

 

Removes an object from the collection.

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

NameDescription
System_CAPS_pubmethodRemove(KeyValuePair<String, Object>)

Removes the first occurrence of a specified object from the collection.

System_CAPS_pubmethodRemove(String)

Removes the element from the collection using the specified key.

Return to top

ViewDataDictionary.Remove Method (KeyValuePair<String, Object>)

Removes the first occurrence of a specified object from the collection.

No code example is currently available or this language may not be supported.

Parameters

item
Type: System.Collections.Generic.KeyValuePair<StringObject>

The object to remove from the collection.

Return Value

Type: System.Boolean

true if item was successfully removed from the collection; otherwise, false. This method also returns false if item is not found in the collection.

Exception Condition
NotSupportedException

The collection is read-only.

Return to top

ViewDataDictionary.Remove Method (String)

Removes the element from the collection using the specified key.

No code example is currently available or this language may not be supported.

Parameters

key
Type: System.String

The key of the element to remove.

Return Value

Type: System.Boolean

true if the element is successfully removed; otherwise, false. This method also returns false if key was not found in the original collection.

Exception Condition
NotSupportedException

The collection is read-only.

ArgumentNullException

key is null.

Return to top
Show: