diff --git a/S7.Net/Types/S7String.cs b/S7.Net/Types/S7String.cs
index 46c4808..290aa53 100644
--- a/S7.Net/Types/S7String.cs
+++ b/S7.Net/Types/S7String.cs
@@ -58,7 +58,7 @@ namespace S7.Net.Types
/// The string to convert to byte array.
/// The length (in characters) allocated in PLC for the string.
/// A containing the string header and string value with a maximum length of + 2.
- public static byte[] ToByteArray(string value, int reservedLength)
+ public static byte[] ToByteArray(string? value, int reservedLength)
{
if (value is null)
{
diff --git a/S7.Net/Types/S7WString.cs b/S7.Net/Types/S7WString.cs
index 8d8aabf..001c7ef 100644
--- a/S7.Net/Types/S7WString.cs
+++ b/S7.Net/Types/S7WString.cs
@@ -48,7 +48,7 @@ namespace S7.Net.Types
/// The string to convert to byte array.
/// The length (in characters) allocated in PLC for the string.
/// A containing the string header and string value with a maximum length of + 4.
- public static byte[] ToByteArray(string value, int reservedLength)
+ public static byte[] ToByteArray(string? value, int reservedLength)
{
if (value is null)
{