DatabaseExtensionsToChar Method
This is used to convert a string value to a nullable Char by returning null if the string is
null or empty or the first character of the string if not.
Namespace: EWSoftware.EntityFrameworkAssembly: EWSoftware.EntityFramework (in EWSoftware.EntityFramework.dll) Version: 2025.11.12.0
public static char? ToChar(
this string? value
)
<ExtensionAttribute>
Public Shared Function ToChar (
value As String
) As Char?
public:
[ExtensionAttribute]
static Nullable<wchar_t> ToChar(
String^ value
)
[<ExtensionAttribute>]
static member ToChar :
value : string -> Nullable<char>
- value String
- The value to check
NullableCharIf the value is null or an empty string, this returns
null. If not, it returns the
first character of the string.In Visual Basic and C#, you can call this method as an instance method on any object of type
String. 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).
using var dataContext = new MyDbContext();
dataContext.spAddName(txtLastName.Text, txtFirstName.Text.NullIfWhiteSpace(),
txtRace.Text.ToChar(), txtSex.Text.ToChar(),
dtpDOB.BindableValue.ToNullable<DateTime>());