JsonObject.GetNamedValue Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
GetNamedValue(String, JsonValue) |
Gets the specified JsonValue value, or the provided default value if no such named value is found. |
GetNamedValue(String) |
Gets the JsonValue value with the specified name. |
GetNamedValue(String, JsonValue)
public:
virtual JsonValue ^ GetNamedValue(Platform::String ^ name, JsonValue ^ defaultValue) = GetNamedValue;
/// [Windows.Foundation.Metadata.Overload("GetNamedValueOrDefault")]
JsonValue GetNamedValue(winrt::hstring const& name, JsonValue const& defaultValue);
[Windows.Foundation.Metadata.Overload("GetNamedValueOrDefault")]
public JsonValue GetNamedValue(string name, JsonValue defaultValue);
function getNamedValue(name, defaultValue)
Public Function GetNamedValue (name As String, defaultValue As JsonValue) As JsonValue
Parameters
- name
-
String
Platform::String
winrt::hstring
The name.
- defaultValue
- JsonValue
The default value to use if the JSON property is not found.
Returns
The JsonValue with the specified name, or if this value wasn't found, the defaultValue is returned.
- Attributes
See also
Applies to
GetNamedValue(String)
public:
virtual JsonValue ^ GetNamedValue(Platform::String ^ name) = GetNamedValue;
JsonValue GetNamedValue(winrt::hstring const& name);
public JsonValue GetNamedValue(string name);
function getNamedValue(name)
Public Function GetNamedValue (name As String) As JsonValue
Parameters
- name
-
String
Platform::String
winrt::hstring
The name.
Returns
The JsonValue value with the specified name.
Remarks
This method should always used with a try/catch block because it throws an exception if the name found is not a JsonValue type or the name is not found.