FileStream.Unlock Method (Int64, Int64)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Allows access by other processes to all or part of a file that was previously locked.

Namespace:   System.IO
Assembly:  mscorlib (in mscorlib.dll)

abstract Unlock : 
        position:int64 *
        length:int64 -> unit
override Unlock : 
        position:int64 *
        length:int64 -> unit


Type: System.Int64

The beginning of the range to unlock.

Type: System.Int64

The range to be unlocked.

Exception Condition

position or length is negative.

For a list of common file and directory operations, see Common I-O Tasks.

The following code example demonstrates how to lock part of a file so another process cannot access that part of the file even though it has read/write access to the file, and then unlock the specified part of the file . Run the program simultaneously in different command windows and investigate using the different console input options.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top