共用方式為


ServiceCollection.MakeReadOnly Method

Definition

Makes this collection read-only.

public:
 void MakeReadOnly();
public void MakeReadOnly ();
member this.MakeReadOnly : unit -> unit
Public Sub MakeReadOnly ()

Remarks

After the collection is marked as read-only, any further attempt to modify it throws an InvalidOperationException.

Applies to