SqlGeometry.Deserialize Método
Returns a constructed SqlGeometry from an internal SQL Server format for spatial data.
Espacio de nombres: Microsoft.SqlServer.Types
Ensamblado: Microsoft.SqlServer.Types (en Microsoft.SqlServer.Types.dll)
Sintaxis
'Declaración
Public Shared Function Deserialize ( _
bytes As SqlBytes _
) As SqlGeometry
'Uso
Dim bytes As SqlBytes
Dim returnValue As SqlGeometry
returnValue = SqlGeometry.Deserialize(bytes)
public static SqlGeometry Deserialize(
SqlBytes bytes
)
public:
static SqlGeometry^ Deserialize(
SqlBytes^ bytes
)
static member Deserialize :
bytes:SqlBytes -> SqlGeometry
public static function Deserialize(
bytes : SqlBytes
) : SqlGeometry
Parámetros
- bytes
Tipo: System.Data.SqlTypes.SqlBytes
A SqlBytes that specifies the spatial data being sent over the network.
Valor devuelto
Tipo: Microsoft.SqlServer.Types.SqlGeometry
A SqlGeometry instance that represents the constructed geometry object being sent over the network.
Comentarios
This can be used for reading bytes sent from the server through SqlDataReader. Useful for sending spatial data over the network in conjunction with Serialize().
Ejemplos
using (SqlConnection conn = new SqlConnection("..."))
{
SqlCommand cmd = new SqlCommand("SELECT [SpatialData] FROM [SpatialTable]", conn);
conn.Open();
using (SqlDataReader rdr = cmd.ExecuteReader())
{
while (rdr.Read())
{
SqlGeometry g = SqlGeometry.Deserialize(reader.GetSqlBytes(0).Stream));
// do some spatial work
}
}