다음을 통해 공유


WaitForChangedResult 구조체

발생한 변경 내용에 대한 정보를 포함합니다.

네임스페이스: System.IO
어셈블리: System(system.dll)

구문

‘선언
Public Structure WaitForChangedResult
‘사용 방법
Dim instance As WaitForChangedResult
public struct WaitForChangedResult
public value class WaitForChangedResult
public final class WaitForChangedResult extends ValueType
JScript에서는 구조체를 사용할 수 있지만 새로 선언할 수는 없습니다.

예제

이 예제에서는 특정 파일 변경 알림이 발생할 때까지 기다리도록 FileSystemWatcher를 동기적으로 사용하는 방법을 보여 줍니다.

Imports System.IO

Module Module1
    Sub Main()
        ' Define a path and a file name for a temporary file.
        Dim pathname As String = "C:\"
        Dim filename As String = "JunkFile.tmp"
        Dim filepathname As String = Path.Combine(pathname, filename)

        ' Create the temporary file and then close it.
        File.Create(filepathname).Close()

        Console.WriteLine("This application will terminate when you delete the {0} file", filepathname)

        ' Have a FileSystemWatcher monitor the path and file for changes.
        Dim fsw As New FileSystemWatcher(pathname, filename)
        fsw.NotifyFilter = NotifyFilters.FileName
        fsw.EnableRaisingEvents = True

        ' Suspend the calling thread until the file has been deleted.
        Dim cr As IO.WaitForChangedResult = fsw.WaitForChanged(WatcherChangeTypes.Deleted)

        ' Tell the user the file is deleted and exit.
        Console.WriteLine("The {0} files is deleted; program is exiting", cr.Name)
    End Sub
End Module

' This code produces the following output.
' 
'  This application will terminate when you delete the C:\JunkFile.tmp file
'  The JunkFile.tmp files is deleted; program is exiting

스레드로부터의 안전성

이 형식의 모든 public static(Visual Basic의 경우 Shared) 멤버는 스레드로부터 안전합니다. 인터페이스 멤버는 스레드로부터 안전하지 않습니다.

플랫폼

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

참고 항목

참조

WaitForChangedResult 멤버
System.IO 네임스페이스
FileSystemEventArgs 클래스
FileSystemEventHandler 대리자
FileSystemWatcher 클래스
InternalBufferOverflowException 클래스
NotifyFilters 열거형
RenamedEventArgs 클래스
RenamedEventHandler 대리자
WaitForChanged
WatcherChangeTypes