UrlMappingCollection.Clear 메서드

정의

컬렉션에서 UrlMapping 모든 개체를 제거합니다.

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

예제

다음 코드 예제에서는 .에서 모든 UrlMapping 개체를 UrlMappingCollection제거합니다.

컬렉션을 가져오는 방법을 알아보려면 클래스 항목의 UrlMappingCollection 코드 예제를 참조하세요.


// Clear the url mapping collection.
urlMappings.Clear();

// Update the configuration file.

// Define the save modality.
ConfigurationSaveMode saveMode =
  ConfigurationSaveMode.Minimal;

urlMappings.EmitClear =
   Convert.ToBoolean(parm2);

if (parm1 == "none")
{
  if (!urlMappingSection.IsReadOnly())
    configuration.Save();
  msg = String.Format(
  "Default modality, EmitClear:      {0}",
  urlMappings.EmitClear.ToString());
}
else
{
  if (parm1 == "full")
    saveMode = ConfigurationSaveMode.Full;
  else
    if (parm1 == "modified")
      saveMode = ConfigurationSaveMode.Modified;

  if (!urlMappingSection.IsReadOnly())
    configuration.Save(saveMode);

  msg = String.Format(
   "Save modality:      {0}",
   saveMode.ToString());
}
' Clear the url mapping collection.
urlMappings.Clear()

' Update the configuration file.
' Define the save modality.
Dim saveMode _
As ConfigurationSaveMode = _
ConfigurationSaveMode.Minimal

urlMappings.EmitClear = _
Convert.ToBoolean(parm2)

If parm1 = "none" Then
    If Not urlMappingSection.IsReadOnly() Then
        configuration.Save()
    End If
    msg = String.Format( _
    "Default modality, EmitClear:      {0}", _
    urlMappings.EmitClear.ToString())
Else
    If parm1 = "full" Then
        saveMode = ConfigurationSaveMode.Full
    ElseIf parm1 = "modified" Then
        saveMode = ConfigurationSaveMode.Modified
    End If
    If Not urlMappingSection.IsReadOnly() Then
        configuration.Save(saveMode)
    End If
    msg = String.Format( _
    "Save modality:      {0}", _
    saveMode.ToString())
End If

설명

메서드를 호출 Clear 한 후 구성 파일을 저장하면 결과는 선택한 ConfigurationSaveMode항목에 따라 달라집니다.

다음 목록에서는 메서드를 사용하여 Save 파일을 저장하는 경우에 적용되는 조건을 설명합니다.

  • 매개 변수 값을 전달 Full 하거나 ConfigurationSaveMode.Modified 매개 변수 값 clear 으로 지정하면 요소가 현재 계층 구조 수준에서 구성 파일의 섹션에 삽입 urlMappings 됩니다.

  • 매개 변수 값으로 전달 Minimal 하면 일련의 remove 요소가 현재 계층 구조 수준에서 구성 파일의 추가됩니다 urlMappings . 이러한 remove 요소는 계층 구조의 add 상위 수준에서 부모 구성 파일에 정의된 요소에 대한 모든 참조를 제거합니다. Minimal 열거형 값을 사용하면 구성 파일로 serialize되는 항목에 영향을 주는 추가 속성이 컬렉션에 하나 있습니다. 속성은 EmitClear 기본적으로입니다 false . 다음 조건 중 하나가 적용됩니다.

    • EmitClear(이)가 true(으)로 설정됩니다. clear 요소는 현재 계층 수준에서 구성 파일의 섹션에 삽입 urlMappings 됩니다. 이렇게 하면 계층 구조의 add 상위 수준에서 부모 구성 파일에 정의된 요소에 대한 모든 참조가 제거됩니다.

    • EmitClear 플래그가 .로 설정됩니다 false. 이 경우 현재 계층 수준에서 구성 파일의 섹션에서 요소를 clear 제거하는 urlMappings 효과가 있습니다( 있는 경우).

메서드는 Clear 실제로 현재 계층 수준에서 구성 파일의 섹션에 정의 된 add 요소를 삭제 urlMappings 합니다. 또한 계층 구조의 상위 수준에서 부모 구성 파일에 정의된 요소에 대한 모든 참조 add 를 제거하지만 삭제하지는 않습니다.

적용 대상

추가 정보