共用方式為


DbSpatialServices.Distance 方法 (DbGeography, DbGeography)

[此頁面專屬於 Entity Framework 第 6 版。最新版本可從 'Entity Framework' NuGet 套件取得。如需 Entity Framework 的詳細資訊,請參閱 msdn.com/data/ef。]

計算兩個 DbGeography 值中最接近點之間的距離。

命名空間:  System.Data.Entity.Spatial
組件:  EntityFramework (在 EntityFramework.dll 中)

語法

'宣告
Public MustOverride Function Distance ( _
    geographyValue As DbGeography, _
    otherGeography As DbGeography _
) As Double
'用途
Dim instance As DbSpatialServices 
Dim geographyValue As DbGeography 
Dim otherGeography As DbGeography 
Dim returnValue As Double 

returnValue = instance.Distance(geographyValue, _
    otherGeography)
public abstract double Distance(
    DbGeography geographyValue,
    DbGeography otherGeography
)
public:
virtual double Distance(
    DbGeography^ geographyValue, 
    DbGeography^ otherGeography
) abstract
abstract Distance : 
        geographyValue:DbGeography * 
        otherGeography:DbGeography -> float
public abstract function Distance(
    geographyValue : DbGeography, 
    otherGeography : DbGeography
) : double

參數

傳回值

類型:System.Double
指定 geographyValue 與 otherGeography 中兩個最接近點之間距離的雙精度浮點數值。

例外狀況

例外狀況 條件
ArgumentNullException

geographyValue 或 otherGeography 為 null。

ArgumentException

geographyValue 或 otherGeography 與此空間服務實作不相容。

請參閱

參考

DbSpatialServices 類別

Distance 多載

System.Data.Entity.Spatial 命名空間