Parsing String into multiple variable length String (C#)
- by Nassign
I am currently trying to convert a VB6 program into C#. There was extensive use of string splitting into structure. For example,
Dim Sample AS String
Sample = "John Doe New York Test Comment"
Public Type Struct1
Name As String * 15
Address As String * 10
Comment As String * 20
End Type
Dim dataStruct As Struct1
Set dataStruct = Sample
When the dataStruct is set, it will automatically split value into the 3 structure member. Is there a special function to do this in C#. The only way I know how to do this is thru Attributes/Annotation describing the length and start position of string. Any other suggestion?