語言

RouteCollection.SetItem(Int32, RouteBase) 方法

定義

取代位於指定索引處的路由。

protected:
 override void SetItem(int index, System::Web::Routing::RouteBase ^ item);
protected override void SetItem(int index, System.Web.Routing.RouteBase item);
override this.SetItem : int * System.Web.Routing.RouteBase -> unit
Protected Overrides Sub SetItem (index As Integer, item As RouteBase)

參數

index
Int32

路線的零基索引要替換。

item
RouteBase

在指定索引處加入的路徑。

例外狀況

item 是 null。

item 已經在收藏中。

備註

當你在物件中新增未命名的路由 RouteCollection 時,你無法新增已經在集合中的路由。

善用這個 GetReadLock 方法和方法 GetWriteLock ,確保你與收藏互動時不會與其他流程產生衝突。

適用於

另請參閱