diff --git a/S7.Net.UnitTest/Helpers/TestStruct.cs b/S7.Net.UnitTest/Helpers/TestStruct.cs
index 7171d83..f07688a 100644
--- a/S7.Net.UnitTest/Helpers/TestStruct.cs
+++ b/S7.Net.UnitTest/Helpers/TestStruct.cs
@@ -58,7 +58,8 @@ namespace S7.Net.UnitTest.Helpers
///
/// DB1.DBX20.0
///
- [S7String(S7StringType.S7WString, 10)] public string WStringVariable;
+ [S7String(S7StringType.S7WString, 10)]
+ public string WStringVariable;
///
/// DB1.DBX44.0
diff --git a/S7.Net/Types/S7StringAttribute.cs b/S7.Net/Types/S7StringAttribute.cs
index 50ad5fc..3c7a415 100644
--- a/S7.Net/Types/S7StringAttribute.cs
+++ b/S7.Net/Types/S7StringAttribute.cs
@@ -57,11 +57,11 @@ namespace S7.Net.Types
///
/// ASCII string.
///
- S7String,
+ S7String = VarType.S7String,
///
/// Unicode string.
///
- S7WString
+ S7WString = VarType.S7WString
}
}
diff --git a/S7.Net/Types/Struct.cs b/S7.Net/Types/Struct.cs
index 5f18980..357820c 100644
--- a/S7.Net/Types/Struct.cs
+++ b/S7.Net/Types/Struct.cs
@@ -65,7 +65,7 @@ namespace S7.Net.Types
case "String":
S7StringAttribute? attribute = info.GetCustomAttributes().SingleOrDefault();
if (attribute == default(S7StringAttribute))
- throw new ArgumentException("Please add S7StringAttribute to the field you are trying to read or write");
+ throw new ArgumentException("Please add S7StringAttribute to the string field");
numBytes = Math.Ceiling(numBytes);
if ((numBytes / 2 - Math.Floor(numBytes / 2.0)) > 0)
@@ -192,7 +192,7 @@ namespace S7.Net.Types
case "String":
S7StringAttribute? attribute = info.GetCustomAttributes().SingleOrDefault();
if (attribute == default(S7StringAttribute))
- throw new ArgumentException("Please add S7StringAttribute to the field you are trying to read or write");
+ throw new ArgumentException("Please add S7StringAttribute to the string field");
numBytes = Math.Ceiling(numBytes);
if ((numBytes / 2 - Math.Floor(numBytes / 2.0)) > 0)
@@ -294,7 +294,7 @@ namespace S7.Net.Types
case "String":
S7StringAttribute? attribute = info.GetCustomAttributes().SingleOrDefault();
if (attribute == default(S7StringAttribute))
- throw new ArgumentException("Please add S7StringAttribute to the field you are trying to read or write");
+ throw new ArgumentException("Please add S7StringAttribute to the string field");
bytes2 = attribute.Type switch
{