SerializationInfoExtensionsGetValueOrDefaultT(SerializationInfo, String, T) Method
Namespace: KGySoft.Serialization.BinaryAssembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 10.0.0
public static T GetValueOrDefault<T>(
this SerializationInfo info,
string name,
T defaultValue = null
)
<ExtensionAttribute>
Public Shared Function GetValueOrDefault(Of T) (
info As SerializationInfo,
name As String,
Optional defaultValue As T = Nothing
) As T
public:
[ExtensionAttribute]
generic<typename T>
static T GetValueOrDefault(
SerializationInfo^ info,
String^ name,
T defaultValue = nullptr
)
[<ExtensionAttribute>]
static member GetValueOrDefault :
info : SerializationInfo *
name : string *
?defaultValue : 'T
(* Defaults:
let _defaultValue = defaultArg defaultValue null
*)
-> 'T
- info SerializationInfo
- The SerializationInfo to retrieve the value from.
- name String
- The name of the value to be retrieved.
- defaultValue T (Optional)
- The default value to return if name was not found. This parameter is optional.
Default value: if T is a reference type; otherwise, the bitwise zero value of T.
- T
- The type of the value with the corresponding name to get.
TThe found value or
defaultValue if
name was not found or its value cannot be cast to
T.In Visual Basic and C#, you can call this method as an instance method on any object of type
SerializationInfo. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).