DotNetBrowser  1.14
Public Member Functions | Properties | List of all members
DotNetBrowser.IWebStorage Interface Reference

The IWebStorage interface of the Web Storage API provides access to the session storage or local storage for a particular document on the loaded web page, allowing you to for example add, modify or delete stored data items. More...

Public Member Functions

string Key (long index)
 Returns the name of the key in the storage. The order of keys is user-agent defined, so you should not rely on it. More...
 
bool Set (string key, string value)
 Adds the key and value to the storage, or updates key's value if it already exists. More...
 
bool Remove (string key)
 Removes the element with the specified key from the storage. More...
 
bool Clear ()
 Removes all key/value pairs in the storage. More...
 
bool Contains (string key)
 Returns true if storage contains specified key or false otherwise. More...
 

Properties

long Count [get]
 Gets number of key/value pairs in the storage. Returns 0 if the storage hasn't been initialized yet or has no key/value pairs. More...
 
string this[string key] [get]
 Gets the value associated with the given key or null when the key doesn't exist. More...
 

Detailed Description

The IWebStorage interface of the Web Storage API provides access to the session storage or local storage for a particular document on the loaded web page, allowing you to for example add, modify or delete stored data items.

Member Function Documentation

bool DotNetBrowser.IWebStorage.Clear ( )

Removes all key/value pairs in the storage.

Returns
true if storage was successfully cleared. Returns false in case of exceptions or storage was not initialized.
bool DotNetBrowser.IWebStorage.Contains ( string  key)

Returns true if storage contains specified key or false otherwise.

Parameters
keythe name of the key you want to check. Cannot be null.
Returns
true if storage contains specified key or false otherwise.
Exceptions
ArgumentNullExceptionwhen the key is null.
string DotNetBrowser.IWebStorage.Key ( long  index)

Returns the name of the key in the storage. The order of keys is user-agent defined, so you should not rely on it.

Parameters
indexan integer representing the number of the key you want to get the name of. This is a zero-based index. Must be in the range greater than 0 and less than the Count.
Returns
a string containing the name of the key or null.
Exceptions
ArgumentOutOfRangeExceptionwhen the index isn't in the range greater than 0 and less than the Count.
bool DotNetBrowser.IWebStorage.Remove ( string  key)

Removes the element with the specified key from the storage.

Parameters
keykey the name of the key you want to remove. Cannot be null.
Returns
true if key/value pair was successfully removed, or key doesn't exist. Returns false in case of exceptions.
Exceptions
ArgumentNullExceptionwhen the key is null.
bool DotNetBrowser.IWebStorage.Set ( string  key,
string  value 
)

Adds the key and value to the storage, or updates key's value if it already exists.

Parameters
keythe name of the key you want to create. Cannot be null.
valuethe value you want to give the key you are creating. Cannot be null.
Returns
true if key/value pair was successfully added or updated. Returns false in case of exceptions.
Exceptions
ArgumentNullExceptionwhen the key or value is null.

Property Documentation

long DotNetBrowser.IWebStorage.Count
get

Gets number of key/value pairs in the storage. Returns 0 if the storage hasn't been initialized yet or has no key/value pairs.

string DotNetBrowser.IWebStorage.this[string key]
get

Gets the value associated with the given key or null when the key doesn't exist.

Parameters
keythe name of the key you want to retrieve the value of. Cannot be null.
Returns
The element with the specified key.
Exceptions
ArgumentNullExceptionwhen the key is null.