本文整理匯總了C#中System.IO.File.Create方法的典型用法代碼示例。如果您正苦於以下問題:C# File.Create方法的具體用法?C# File.Create怎麽用?C# File.Create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.IO.File
的用法示例。
在下文中一共展示了File.Create方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: TemporaryLocalFile
public TemporaryLocalFile(File backingFile)
{
_backingFile = backingFile;
if (!backingFile.Exists())
backingFile.Create();
}
示例2: Init
//.........這裏部分代碼省略.........
case MoSync.Constants.MA_SEEK_END:
origin = SeekOrigin.End;
break;
default:
throw new Exception("maFileSeek whence");
}
try
{
return (int)fileStream.Seek(_offset, origin);
}
catch (IOException e)
{
MoSync.Util.Log(e);
return MoSync.Constants.MA_FERR_GENERIC;
}
};
ioctls.maFileTell = delegate(int _file)
{
File file = mFileHandles[_file];
if (file.IsDirectory)
return MoSync.Constants.MA_FERR_WRONG_TYPE;
IsolatedStorageFileStream fileStream = file.FileStream;
return (int)fileStream.Position;
};
ioctls.maFileExists = delegate(int _file)
{
File file = mFileHandles[_file];
return file.Exists ? 1 : 0;
};
ioctls.maFileCreate = delegate(int _file)
{
File file = mFileHandles[_file];
if (file.Exists)
return MoSync.Constants.MA_FERR_GENERIC;
file.Create();
return 0;
};
ioctls.maFileDelete = delegate(int _file)
{
File file = mFileHandles[_file];
try
{
file.Delete();
}
catch (IsolatedStorageException e)
{
MoSync.Util.Log(e);
return MoSync.Constants.MA_FERR_GENERIC;
}
return 0;
};
ioctls.maFileSize = delegate(int _file)
{
File file = mFileHandles[_file];
return file.Size();
};
ioctls.maFileAvailableSpace = delegate(int _file)
{
File file = mFileHandles[_file];