Xceed .NET Libraries Documentation
CreateFile(FileSystemEvents,Object,String,Boolean) Method


Xceed.FileSystem Assembly > Xceed.FileSystem Namespace > AbstractFolder Class > CreateFile Method : CreateFile(FileSystemEvents,Object,String,Boolean) Method
A FileSystemEvents object that will be used to raise events. Cannot be a null reference (Nothing in Visual Basic).
Opaque data that will be passed back to the event handler when an event is raised.
Relative name of the new file.
true if the new file should replace an existing file; false otherwise.
Creates a new file in the folder and raises events during the process.
Syntax
'Declaration
 
Public Overloads Function CreateFile( _
   ByVal events As FileSystemEvents, _
   ByVal userData As Object, _
   ByVal relativeName As String, _
   ByVal replaceIfExists As Boolean _
) As AbstractFile
'Usage
 
Dim instance As AbstractFolder
Dim events As FileSystemEvents
Dim userData As Object
Dim relativeName As String
Dim replaceIfExists As Boolean
Dim value As AbstractFile
 
value = instance.CreateFile(events, userData, relativeName, replaceIfExists)
public AbstractFile CreateFile( 
   FileSystemEvents events,
   object userData,
   string relativeName,
   bool replaceIfExists
)

Parameters

events
A FileSystemEvents object that will be used to raise events. Cannot be a null reference (Nothing in Visual Basic).
userData
Opaque data that will be passed back to the event handler when an event is raised.
relativeName
Relative name of the new file.
replaceIfExists
true if the new file should replace an existing file; false otherwise.

Return Value

An AbstractFile object representing the newly created file.
Remarks

The relativeName parameter can include relative path information, in which ".." means "previous folder". For example: "folder/file.txt", "../file.txt", etc.

If a file named relativeName already exist in the destination folder and replaceIfExists is false, an exception is thrown. If replaceIfExists is true, the existing file is replaced by the newly created one.

If the physical folder in which the new file is to be created does not exist, it is created.

The current property values (such as FileSystemItem.Attributes) are applied to the newly created file.

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

AbstractFolder Class
AbstractFolder Members
Overload List