I'm creating some unit tests for a piece of code that returns a SqlGeography type. To mock up the SqlGeography column I'd like to use SqlGeography.STLineFromText to create a line string. Problem is STLineFromText takes SqlChars as a parameter. Does anyone know how to convert a C# string to SqlChars?
new SqlChars(new SqlString(text));
Use this:
new SqlChars(text.ToCharArray());
You should be able to use the SqlChars constructor:
SqlChars c = new SqlChars("test".ToArray());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With