This is the definition of my parameter:
var param = new SqlParameter
{
ParameterName = "@param",
SqlDbType = SqlDbType.Xml,
Direction = ParameterDirection.Output,
Size = int.MaxValue
};
command.Parameters.Add(param);
Then I do:
command.ExecuteNonQuery();
And finally:
XmlSerializer serializer = new XmlSerializer(typeof(MyClass));
return serializer.Deserialize(
new MemoryStream(Encoding.UTF8.GetBytes(param.Value.ToString())))
as MyClass;
Do I need to convert to a string and then a byte array?
source
share