Udostępnij za pośrednictwem


ViewDataDictionary.Add Method (String, Object)

Adds an element to the collection using the specified key and value .

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

Syntax

'Declaration
Public Sub Add ( _
    key As String, _
    value As Object _
)
public void Add(
    string key,
    Object value
)
public:
virtual void Add(
    String^ key, 
    Object^ value
) sealed

Parameters

Implements

IDictionary<TKey, TValue>.Add(TKey, TValue)

Exceptions

Exception Condition
NotSupportedException

The IDictionary<TKey, TValue> object is read-only.

ArgumentNullException

key is null.

ArgumentException

An element with the same key already exists in the IDictionary<TKey, TValue> object.

See Also

Reference

ViewDataDictionary Class

Add Overload

System.Web.Mvc Namespace