¡@

Home 

c# Programming Glossary: filestream

What is AsyncCallback?

http://stackoverflow.com/questions/1047662/what-is-asynccallback

System.Environment.CurrentDirectory mfc71.pdb FileStream strm new FileStream filename FileMode.Open FileAccess.Read FileShare.Read.. mfc71.pdb FileStream strm new FileStream filename FileMode.Open FileAccess.Read FileShare.Read 1024 FileOptions.Asynchronous.. IAsyncResult result Console.WriteLine Read Completed FileStream strm FileStream result.AsyncState Finished so we can call EndRead..

XML Serialize generic list of serializable objects

http://stackoverflow.com/questions/1212742/xml-serialize-generic-list-of-serializable-objects

new XmlSerializer typeof PersonalList personTypes FileStream fs new FileStream Personenliste.xml FileMode.Create serializer.Serialize.. typeof PersonalList personTypes FileStream fs new FileStream Personenliste.xml FileMode.Create serializer.Serialize fs personen.. fs personen fs.Close personen null Deserialize fs new FileStream Personenliste.xml FileMode.Open personen PersonalList serializer.Deserialize..

How do you check for permissions to write to a directory or file?

http://stackoverflow.com/questions/130617/how-do-you-check-for-permissions-to-write-to-a-directory-or-file

one below. public void ExportToFile string filename using FileStream fstream new FileStream filename FileMode.Create using TextWriter.. ExportToFile string filename using FileStream fstream new FileStream filename FileMode.Create using TextWriter writer new StreamWriter.. Int32 errorCode String maybeFullPath at System.IO.FileStream.Init String path FileMode mode FileAccess access nt32 rights..

How to compare 2 files fast using .NET?

http://stackoverflow.com/questions/1358510/how-to-compare-2-files-fast-using-net

.NET Typical approaches recommend reading the binary via FileStream and comparing it byte by byte. Would a checksum comparison such..

Print existing PDF (or other files) in C#

http://stackoverflow.com/questions/273675/print-existing-pdf-or-other-files-in-c-sharp

string tempFile tempFile Path.GetTempFileName using FileStream fs new FileStream tempFile FileMode.Create fs.Write formPdfData.. tempFile Path.GetTempFileName using FileStream fs new FileStream tempFile FileMode.Create fs.Write formPdfData 0 formPdfData.Length..

Get last 10 lines of very large text file > 10GB c#

http://stackoverflow.com/questions/398378/get-last-10-lines-of-very-large-text-file-10gb-c-sharp

n byte buffer encoding.GetBytes tokenSeparator using FileStream fs new FileStream path FileMode.Open Int64 tokenCount 0 Int64.. encoding.GetBytes tokenSeparator using FileStream fs new FileStream path FileMode.Open Int64 tokenCount 0 Int64 endPosition fs.Length..

Calling null on a class vs Dispose()

http://stackoverflow.com/questions/574019/calling-null-on-a-class-vs-dispose

to dispose of it in an orderly manner. So if you open a FileStream but forget to call Dispose or Close the finalizer will eventually.. only indirectly hold unmanaged resources e.g. you've got a FileStream as a member variable then adding your own finalizer won't help.. collection when your object is so you can just rely on FileStream having a finalizer if necessary it may refer to something else..

Convert a bitmap into a byte array in C#?

http://stackoverflow.com/questions/7350679/convert-a-bitmap-into-a-byte-array-in-c

saving to a temporary file and reading the result using a FileStream c# bitmap share improve this question There are a couple..

Is there a way to check if a file is in use?

http://stackoverflow.com/questions/876473/is-there-a-way-to-check-if-a-file-is-in-use

the time protected virtual bool IsFileLocked FileInfo file FileStream stream null try stream file.Open FileMode.Open FileAccess.ReadWrite..

What is the fastest way to create a checksum for large files in C#

http://stackoverflow.com/questions/1177607/what-is-the-fastest-way-to-create-a-checksum-for-large-files-in-c-sharp

Read byte int int to see how much it reads from the filestream which is too small a buffer for disk IO. To speed things up..

Why does BinaryWriter prepend gibberish to the start of a stream? How do you avoid it?

http://stackoverflow.com/questions/1488486/why-does-binarywriter-prepend-gibberish-to-the-start-of-a-stream-how-do-you-avo

the unicode character that looks like gibberish. c# .net filestream binarywriter share improve this question They are not byte..

Redirect stdout+stderr on a C# Windows service

http://stackoverflow.com/questions/1579074/redirect-stdoutstderr-on-a-c-sharp-windows-service

handle in your service dispose on shutdown.. FileStream filestream StreamWriter streamwriter void Redirect int status IntPtr handle.. streamwriter void Redirect int status IntPtr handle filestream new FileStream logfile.txt FileMode.Create streamwriter new.. logfile.txt FileMode.Create streamwriter new StreamWriter filestream streamwriter.AutoFlush true Console.SetOut streamwriter Console.SetError..

C# FileStream : Optimal buffer size for writing large files?

http://stackoverflow.com/questions/1862982/c-sharp-filestream-optimal-buffer-size-for-writing-large-files

or should I stick to kilobyte buffers c# size buffer filestream share improve this question Default buffer size is 4 KiB...

Edit a specific Line of a Text File in C#

http://stackoverflow.com/questions/1971008/edit-a-specific-line-of-a-text-file-in-c-sharp

lines the rest get lost. What can I do THANKS c# stream filestream share improve this question You can't rewrite a line without..

.NET code to send ZPL to Zebra printers

http://stackoverflow.com/questions/2044676/net-code-to-send-zpl-to-zebra-printers

é válida if printer.IsInvalid true return Open the filestream to the lpt1 port and send the command FileStream lpt1 new FileStream..

Access files from network share in c# web app

http://stackoverflow.com/questions/29346/access-files-from-network-share-in-c-sharp-web-app

not quite sure how to join the dots between creating the filestream and specifying the credentials to use in the web application...

FileUpload to FileStream

http://stackoverflow.com/questions/3068303/fileupload-to-filestream

FileUpload UI. Here i need to convert the File Upload to filestream to send the stream along with HttpWebRequest. How do i convert.. with HttpWebRequest. How do i convert the FileUpload to a filestream c# asp.net file upload stream filestream share improve this.. FileUpload to a filestream c# asp.net file upload stream filestream share improve this question Might be better to pipe the..

simultaneous read-write a file in C#

http://stackoverflow.com/questions/3817477/simultaneous-read-write-a-file-in-c-sharp

Based on this thread it looks like I should just create a filestream and pass it both to a writer and reader. However when the reader.. After getting past f the reader returns null. c# filestream streamreader streamwriter share improve this question Ok..

Free file locked by new Bitmap(filePath)

http://stackoverflow.com/questions/4803935/free-file-locked-by-new-bitmapfilepath

file picturebox share improve this question Using a filestream will unlock the file once it has been read from and disposed..

Serialize Class containing Dictionary member

http://stackoverflow.com/questions/495647/serialize-class-containing-dictionary-member

string public Boolean Save String filename using var filestream File.Open filename FileMode.OpenOrCreate FileAccess.ReadWrite.. new XmlSerializer typeof ConfigFile serializer.Serialize filestream this return true catch Exception e MessageBox.Show e.Message.. public static ConfigFile Load string filename using var filestream File.Open filename FileMode.Open FileAccess.Read try var..

How to both Read/Write File in C#

http://stackoverflow.com/questions/605685/how-to-both-read-write-file-in-c-sharp

can I both read from and write to a file in C# c# file io filestream share improve this question Don't forget the easy route..

How write a file using StreamWriter in Windows 8?

http://stackoverflow.com/questions/10290820/how-write-a-file-using-streamwriter-in-windows-8

await folder.CreateFileAsync using IRandomAccessStream fileStream await file.OpenAsync FileAccessMode.ReadWrite using IOutputStream.. FileAccessMode.ReadWrite using IOutputStream outputStream fileStream.GetOutputStreamAt 0 using DataWriter dataWriter new DataWriter..

File.Copy vs. Manual FileStream.Write For Copying File

http://stackoverflow.com/questions/1246899/file-copy-vs-manual-filestream-write-for-copying-file

outputFilePath int bufferSize 1024 64 using FileStream fileStream new FileStream outputFilePath FileMode.OpenOrCreate FileAccess.Write.. while bytesRead inStream.Read bytes 0 bufferSize 0 fileStream.Write bytes 0 bytesRead fileStream.Flush Does anyone know why.. bytes 0 bufferSize 0 fileStream.Write bytes 0 bytesRead fileStream.Flush Does anyone know why this performs so much slower than..

How can I read an Access file (.accdb) from a stream?

http://stackoverflow.com/questions/14475968/how-can-i-read-an-access-file-accdb-from-a-stream

temp.accdb using var fileStream File.Create tempFilePath accDbStream.InputStream.CopyTo fileStream..

How to force ADO.Net to use only the System.String DataType in the readers TableSchema

http://stackoverflow.com/questions/2567673/how-to-force-ado-net-to-use-only-the-system-string-datatype-in-the-readers-table

result const string path @ .... Test.xlsx using var fileStream new FileStream path FileMode.Open FileAccess.Read using var.. var excelReader ExcelReaderFactory.CreateOpenXmlReader fileStream excelReader.IsFirstRowAsColumnNames true result excelReader.AsDataSet..

How do I dispose my filestream when implementing a file download in ASP.NET?

http://stackoverflow.com/questions/3084366/how-do-i-dispose-my-filestream-when-implementing-a-file-download-in-asp-net

excerpt from this class public FileStreamResult Stream fileStream string contentType base contentType if fileStream null throw.. Stream fileStream string contentType base contentType if fileStream null throw new ArgumentNullException fileStream this.FileStream.. if fileStream null throw new ArgumentNullException fileStream this.FileStream fileStream protected override void WriteFile..

What's the least invasive way to read a locked file in C# (perhaps in unsafe mode)?

http://stackoverflow.com/questions/3560651/whats-the-least-invasive-way-to-read-a-locked-file-in-c-sharp-perhaps-in-unsaf

the article private void LoadFile try using FileStream fileStream new FileStream logs myapp.log FileMode.Open FileAccess.Read.. using StreamReader streamReader new StreamReader fileStream this.textBoxLogs.Text streamReader.ReadToEnd catch Exception..

How do you upload a file to a document library in sharepoint?

http://stackoverflow.com/questions/468469/how-do-you-upload-a-file-to-a-document-library-in-sharepoint

System.IO.Path.GetFileName fileToUpload FileStream fileStream File.OpenRead fileToUpload Upload document SPFile spfile myLibrary.Files.Add.. Upload document SPFile spfile myLibrary.Files.Add fileName fileStream replaceExistingFiles Commit myLibrary.Update share improve..

Using System.IO.Packaging to generate a ZIP file

http://stackoverflow.com/questions/6386113/using-system-io-packaging-to-generate-a-zip-file

uri CompressionOption.Normal using FileStream fileStream new FileStream fileToAdd FileMode.Open FileAccess.Read using.. using Stream dest part.GetStream CopyStream fileStream dest private static void CopyStream System.IO.FileStream..

How to create a password protected file in C#

http://stackoverflow.com/questions/740837/how-to-create-a-password-protected-file-in-c-sharp

keyGenerator.GetBytes rijndael.KeySize 8 using var fileStream targetFile.Create write random salt fileStream.Write keyGenerator.Salt.. using var fileStream targetFile.Create write random salt fileStream.Write keyGenerator.Salt 0 SaltSize using var cryptoStream new.. 0 SaltSize using var cryptoStream new CryptoStream fileStream rijndael.CreateEncryptor CryptoStreamMode.Write write data..