¡@

Home 

c# Programming Glossary: stream

Encrypt/Decrypt string in .NET

http://stackoverflow.com/questions/202011/encrypt-decrypt-string-in-net

aesAlg.KeySize 8 Create a decryptor to perform the stream transform. ICryptoTransform encryptor aesAlg.CreateEncryptor.. aesAlg.CreateEncryptor aesAlg.Key aesAlg.IV Create the streams used for encryption. using MemoryStream msEncrypt new MemoryStream.. new StreamWriter csEncrypt Write all data to the stream. swEncrypt.Write plainText outStr Convert.ToBase64String..

Best way to copy between two Stream instances

http://stackoverflow.com/questions/230128/best-way-to-copy-between-two-stream-instances

What is the best way to copy the contents of one stream to another Is there a standard utility method for this c# stream.. to another Is there a standard utility method for this c# stream copying share improve this question From .NET 4.5 on there..

How to Deserialize XML document

http://stackoverflow.com/questions/364253/how-to-deserialize-xml-document

removed the reader.ReadToEnd that function reads the whole stream and returns a string so the Deserialze function couldn't use.. the reader anymore...the position was at the end of the stream . I also took a few liberties with the naming . Here are the..

Deep cloning objects in C#

http://stackoverflow.com/questions/78536/deep-cloning-objects-in-c-sharp

default T IFormatter formatter new BinaryFormatter Stream stream new MemoryStream using stream formatter.Serialize stream source.. new BinaryFormatter Stream stream new MemoryStream using stream formatter.Serialize stream source stream.Seek 0 SeekOrigin.Begin.. stream new MemoryStream using stream formatter.Serialize stream source stream.Seek 0 SeekOrigin.Begin return T formatter.Deserialize..

Is it possible to dynamically compile and execute C# code fragments?

http://stackoverflow.com/questions/826398/is-it-possible-to-dynamically-compile-and-execute-c-sharp-code-fragments

to save C# code fragments to a text file or any input stream and then execute those dynamically Assuming what is provided..

How to use HTML Agility pack

http://stackoverflow.com/questions/846994/how-to-use-html-agility-pack

application. The HtmlDocument.Load method also accepts a stream which is very useful in integrating with other stream oriented.. a stream which is very useful in integrating with other stream oriented classes in the .NET framework. While HtmlEntity.DeEntitize..

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

virtual bool IsFileLocked FileInfo file FileStream stream null try stream file.Open FileMode.Open FileAccess.ReadWrite.. IsFileLocked FileInfo file FileStream stream null try stream file.Open FileMode.Open FileAccess.ReadWrite FileShare.None.. exist has already been processed return true finally if stream null stream.Close file is not locked return false Edit Please..

Encrypt/Decrypt string in .NET

http://stackoverflow.com/questions/202011/encrypt-decrypt-string-in-net

Create the streams used for encryption. using MemoryStream msEncrypt new MemoryStream prepend the IV msEncrypt.Write.. for encryption. using MemoryStream msEncrypt new MemoryStream prepend the IV msEncrypt.Write BitConverter.GetBytes aesAlg.IV.Length.. msEncrypt.Write aesAlg.IV 0 aesAlg.IV.Length using CryptoStream csEncrypt new CryptoStream msEncrypt encryptor CryptoStreamMode.Write..

Creating a byte array from a stream

http://stackoverflow.com/questions/221925/creating-a-byte-array-from-a-stream

an input stream Here is my current solution with .NET 3.5. Stream s byte b using BinaryReader br new BinaryReader s b br.ReadBytes.. cases I'd use code like this public static byte ReadFully Stream input byte buffer new byte 16 1024 using MemoryStream ms new.. Stream input byte buffer new byte 16 1024 using MemoryStream ms new MemoryStream int read while read input.Read buffer 0..

Best way to copy between two Stream instances

http://stackoverflow.com/questions/230128/best-way-to-copy-between-two-stream-instances

way to copy between two Stream instances What is the best way to copy the contents of one.. share improve this question From .NET 4.5 on there is the Stream.CopyToAsync method input.CopyToAsync output This will return.. on I O completion . From .NET 4.0 on there's is the Stream.CopyTo method input.CopyTo output For .NET 3.5 and before There..

How to read embedded resource text file

http://stackoverflow.com/questions/3314140/how-to-read-embedded-resource-text-file

to read embedded resource text file How do I read using Streamreader an embedded resource txt file and return it as a string.. Apple string stringToReplace stringToReplace textBox1.Text StreamReader FileReader new StreamReader @ C MyFile.txt string FileContents.. stringToReplace textBox1.Text StreamReader FileReader new StreamReader @ C MyFile.txt string FileContents FileContents FileReader.ReadToEnd..

How do I save a stream to a file?

http://stackoverflow.com/questions/411592/how-do-i-save-a-stream-to-a-file

do I save a stream to a file I have a StreamReader object that I initialized with a stream now I want to.. the stream may be a .gif or .jpg or .pdf . Existing Code StreamReader sr new StreamReader myOtherObject.InputStream I need to.. a .gif or .jpg or .pdf . Existing Code StreamReader sr new StreamReader myOtherObject.InputStream I need to save this to disk..

How to read a text file reversely with iterator in C#

http://stackoverflow.com/questions/452902/how-to-read-a-text-file-reversely-with-iterator-in-c-sharp

say it doesn't still have some subtle bugs around. It uses StreamUtil from MiscUtil but I've included just the necessary new method.. int DefaultBufferSize 4096 summary Means of creating a Stream to read from. summary private readonly Func Stream streamSource.. a Stream to read from. summary private readonly Func Stream streamSource summary Encoding to use when converting bytes to..

Deep cloning objects in C#

http://stackoverflow.com/questions/78536/deep-cloning-objects-in-c-sharp

return default T IFormatter formatter new BinaryFormatter Stream stream new MemoryStream using stream formatter.Serialize stream.. formatter new BinaryFormatter Stream stream new MemoryStream using stream formatter.Serialize stream source stream.Seek..

C# Login to Website via program

http://stackoverflow.com/questions/930807/c-sharp-login-to-website-via-program

formParams req.ContentLength bytes.Length using Stream os req.GetRequestStream os.Write bytes 0 bytes.Length WebResponse.. bytes.Length using Stream os req.GetRequestStream os.Write bytes 0 bytes.Length WebResponse resp req.GetResponse.. WebResponse getResponse getRequest.GetResponse using StreamReader sr new StreamReader getResponse.GetResponseStream pageSource..