SqlGeometry.Deserialize 메서드

SQL Server 2012

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

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

public static SqlGeometry Deserialize(
	SqlBytes bytes
)

매개 변수

bytes
유형: System.Data.SqlTypes.SqlBytes
A SqlBytes that specifies the spatial data being sent over the network.

반환 값

유형: 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

            }
}

커뮤니티 추가 항목

추가
표시: