这是我的参数定义:
var param = new SqlParameter
{
ParameterName = "@param",
SqlDbType = SqlDbType.Xml,
Direction = ParameterDirection.Output,
Size = int.MaxValue
};
command.Parameters.Add(param);
然后我做:
command.ExecuteNonQuery();
最后:
XmlSerializer serializer = new XmlSerializer(typeof(MyClass));
return serializer.Deserialize(
new MemoryStream(Encoding.UTF8.GetBytes(param.Value.ToString())))
as MyClass;
我真的需要先转换为字符串然后再转换为字节数组吗?