NullableExtensionsConvertToNonNullableT Method
Converts an Array of Nullable values
to an Array of non-nullable values of the same Type.
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 T[] ConvertToNonNullable<T>(
this T?[] source,
T defaultIfNull = null
)
where T : struct, new()
<ExtensionAttribute>
<EditorBrowsableAttribute(EditorBrowsableState.Always)>
Public Shared Function ConvertToNonNullable(Of T As {Structure, New}) (
source As T?(),
Optional defaultIfNull As T = Nothing
) As T()
Dim source As T?()
Dim defaultIfNull As T
Dim returnValue As T()
returnValue = source.ConvertToNonNullable(defaultIfNull)
public:
[ExtensionAttribute]
[EditorBrowsableAttribute(EditorBrowsableState::Always)]
generic<typename T>
where T : value class, gcnew()
static array<T>^ ConvertToNonNullable(
array<Nullable<T>>^ source,
T defaultIfNull = nullptr
)
[<ExtensionAttribute>]
[<EditorBrowsableAttribute(EditorBrowsableState.Always)>]
static member ConvertToNonNullable :
source : Nullable<'T>[] *
?defaultIfNull : 'T
(* Defaults:
let _defaultIfNull = defaultArg defaultIfNull null
*)
-> 'T[] when 'T : struct, new()
No code example is currently available or this language may not be supported.
- source NullableT
-
The source Nullable value.
- defaultIfNull T (Optional)
-
The default value to use if Nullable value is null ().
Default value is .
- T
-
The type of the source Nullable value.
T
The resulting Array of non-nullable values.
In Visual Basic and C#, you can call this method as an instance method on any object of type
NullableT. 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 nullableArray As Nullable(Of Byte)() = {0, Nothing, 1}
Dim nonNullableArray As Byte() = nullableArray.ConvertToNonNullable(defaultIfNull:=0)
Console.WriteLine(String.Join(", ", nonNullableArray))
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.