ProviderCollection.SetReadOnly 方法

定义

将集合设置为只读。Sets the collection to be read-only.

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

注解

默认情况下,ProviderCollection 类是可读/写的。The ProviderCollection class is read/write by default. SetReadOnly 方法使集合成为只读的。The SetReadOnly method makes the collection read-only. 集合设置为只读后,某些方法调用(如 RemoveAdd 将导致异常。After a collection is set to read-only, some method calls (such as Remove and Add will result in an exception.

请注意,在创建所有已配置的提供程序的实例后,大多数基于提供程序的功能会将其 ProviderCollection 对象设置为只读。Note that most provider-based features will set their ProviderCollection object to read-only after creating instances of all of the configured providers.

适用于