다음을 통해 공유


SqlGeometry.Deserialize 메서드

Returns a constructed SqlGeometry from an internal SQL Server format for spatial data.

네임스페이스:  Microsoft.SqlServer.Types
어셈블리:  Microsoft.SqlServer.Types(Microsoft.SqlServer.Types.dll)

구문

‘선언
Public Shared Function Deserialize ( _
    bytes As SqlBytes _
) As SqlGeometry
‘사용 방법
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

매개 변수

반환 값

유형: Microsoft.SqlServer.Types.SqlGeometry
A SqlGeometry instance that represents the constructed geometry object being sent over the network.

주의

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().

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

            }
}

참고 항목

참조

SqlGeometry 클래스

Microsoft.SqlServer.Types 네임스페이스