NullableExtensionsConvertToTSource, TTarget Method
Converts a source Nullable value to the target Nullable value.
Namespace: DevCase.Extensions.NullableExtensionsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[EditorBrowsableAttribute(EditorBrowsableState.Always)]
public static TTarget? ConvertTo<TSource, TTarget>(
this TSource? source,
Func<TSource, TTarget> converter
)
where TSource : struct, new()
where TTarget : struct, new()
<ExtensionAttribute>
<EditorBrowsableAttribute(EditorBrowsableState.Always)>
Public Shared Function ConvertTo(Of TSource As {Structure, New}, TTarget As {Structure, New}) (
source As TSource?,
converter As Func(Of TSource, TTarget)
) As TTarget?
Dim source As TSource?
Dim converter As Func(Of TSource, TTarget)
Dim returnValue As TTarget?
returnValue = source.ConvertTo(converter)
public:
[ExtensionAttribute]
[EditorBrowsableAttribute(EditorBrowsableState::Always)]
generic<typename TSource, typename TTarget>
where TSource : value class, gcnew()
where TTarget : value class, gcnew()
static Nullable<TTarget> ConvertTo(
Nullable<TSource> source,
Func<TSource, TTarget>^ converter
)
[<ExtensionAttribute>]
[<EditorBrowsableAttribute(EditorBrowsableState.Always)>]
static member ConvertTo :
source : Nullable<'TSource> *
converter : Func<'TSource, 'TTarget> -> Nullable<'TTarget> when 'TSource : struct, new() when 'TTarget : struct, new()
No code example is currently available or this language may not be supported.
- source NullableTSource
-
The source Nullable value.
- converter FuncTSource, TTarget
-
A function that will serve to convert from
the source Nullable value to the target Nullable value.
- TSource
-
The type of the source Nullable value.
- TTarget
-
The type of the target Nullable value.
NullableTTarget
The resulting
Nullable value.
In Visual Basic and C#, you can call this method as an instance method on any object of type
NullableTSource. 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).
This is a code example.
No code example is currently available or this language may not be supported.
Dim nullableByte As Nullable(Of Byte) = New Byte?(255)
Dim nullableInt32 As Nullable(Of Integer) = nullableByte.ConvertTo(Function(ByVal value As Nullable(Of Byte)) Convert.ToInt32(value))
Console.WriteLine(nullableInt32)
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.