¡@

Home 

c# Programming Glossary: writer

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

new FileStream filename FileMode.Create using TextWriter writer new StreamWriter fstream try catch block for write permissions.. fstream try catch block for write permissions writer.WriteLine text When running the program I get an error Unhandled.. new FileStream filename FileMode.Create using TextWriter writer new StreamWriter fstream try catch block for write permissions..

XML Serialization and Inherited Types

http://stackoverflow.com/questions/20084/xml-serialization-and-inherited-types

public void WriteXml System.Xml.XmlWriter writer Write the Type Name to the XML Element as an Attrib and Serialize.. must be FQN since Types can are external to current. writer.WriteAttributeString type type.AssemblyQualifiedName new XmlSerializer.. new XmlSerializer type .Serialize writer _data #endregion So from there how do we tell the XmlSerializer..

Websocket server: onopen function on the web socket is never called

http://stackoverflow.com/questions/2211898/websocket-server-onopen-function-on-the-web-socket-is-never-called

using var reader new StreamReader stream using var writer new StreamWriter stream writer.WriteLine HTTP 1.1 101 Web Socket.. stream using var writer new StreamWriter stream writer.WriteLine HTTP 1.1 101 Web Socket Protocol Handshake writer.WriteLine.. HTTP 1.1 101 Web Socket Protocol Handshake writer.WriteLine Upgrade WebSocket writer.WriteLine Connection Upgrade..

Why XML-Serializable class need a parameterless constructor

http://stackoverflow.com/questions/267724/why-xml-serializable-class-need-a-parameterless-constructor

new XmlSerializer obj.GetType using StringWriter writer new StringWriter serializer.Serialize writer obj return writer.ToString.. StringWriter writer new StringWriter serializer.Serialize writer obj return writer.ToString If the argument is a instance of.. new StringWriter serializer.Serialize writer obj return writer.ToString If the argument is a instance of class without parameterless..

Proper way to implement IXmlSerializable?

http://stackoverflow.com/questions/279534/proper-way-to-implement-ixmlserializable

evt reader.Read public void WriteXml XmlWriter writer writer.WriteAttributeString Name _name writer.WriteAttributeString.. evt reader.Read public void WriteXml XmlWriter writer writer.WriteAttributeString Name _name writer.WriteAttributeString.. XmlWriter writer writer.WriteAttributeString Name _name writer.WriteAttributeString Enabled _enabled.ToString writer.WriteAttributeString..

What is the best way to build XML in C# code? [closed]

http://stackoverflow.com/questions/284324/what-is-the-best-way-to-build-xml-in-c-sharp-code

but very efficient imagine a big loop here XmlWriter writer XmlWriter.Create Console.Out writer.WriteStartElement Foo writer.WriteAttributeString.. loop here XmlWriter writer XmlWriter.Create Console.Out writer.WriteStartElement Foo writer.WriteAttributeString Bar Some value.. XmlWriter.Create Console.Out writer.WriteStartElement Foo writer.WriteAttributeString Bar Some value writer.WriteElementString..

Can I convert a C# string value to an escaped string literal

http://stackoverflow.com/questions/323640/can-i-convert-a-c-sharp-string-value-to-an-escaped-string-literal

private static string ToLiteral string input using var writer new StringWriter using var provider CodeDomProvider.CreateProvider.. new CodePrimitiveExpression input writer null return writer.ToString This code var input tHello r n.. new CodePrimitiveExpression input writer null return writer.ToString This code var input tHello r n tWorld Console.WriteLine..

Creating pdf files at runtime in c# [closed]

http://stackoverflow.com/questions/465433/creating-pdf-files-at-runtime-in-c-sharp

which allow me to implement a customised pdf writer in C# without using Reporting Services' pdf output option. ..

Change default app.config at runtime

http://stackoverflow.com/questions/6150644/change-default-app-config-at-runtime

CONFIG var tempFileName Path.GetTempFileName using var writer new StreamWriter tempFileName writer.Write combinedConfig using.. using var writer new StreamWriter tempFileName writer.Write combinedConfig using AppConfig.Change tempFileName Console.WriteLine..

.NET XML serialization gotchas? [closed]

http://stackoverflow.com/questions/67959/net-xml-serialization-gotchas

public void WriteXml System.Xml.XmlWriter writer XmlSerializer keySerializer new XmlSerializer typeof TKey XmlSerializer.. XmlSerializer typeof TValue foreach TKey key in this.Keys writer.WriteStartElement item writer.WriteStartElement key keySerializer.Serialize.. TKey key in this.Keys writer.WriteStartElement item writer.WriteStartElement key keySerializer.Serialize writer key writer.WriteEndElement..

How to implement custom JsonConverter in JSON.NET to deserialize a List of base class objects

http://stackoverflow.com/questions/8030538/how-to-implement-custom-jsonconverter-in-json-net-to-deserialize-a-list-of-base

return target public override void WriteJson JsonWriter writer object value JsonSerializer serializer throw new NotImplementedException..

Does disposing streamreader close the stream?

http://stackoverflow.com/questions/1065168/does-disposing-streamreader-close-the-stream

is the stream closed as well I would send a BinaryReader Writer but I am using a StreamReader too maybe I should go around that... share improve this question Yes StreamReader StreamWriter BinaryReader and BinaryWriter all close dispose their underlying.. Yes StreamReader StreamWriter BinaryReader and BinaryWriter all close dispose their underlying streams when you call Dispose..

Can I Serialize XML straight to a string instead of a Stream with C#?

http://stackoverflow.com/questions/1138414/can-i-serialize-xml-straight-to-a-string-instead-of-a-stream-with-c

instead of a Stream with C# This example uses a StringWriter to hold the serialized data then calling ToString gives the.. xmlSerializer new XmlSerializer typeof Person StringWriter stringWriter new StringWriter xmlSerializer.Serialize stringWriter.. new XmlSerializer typeof Person StringWriter stringWriter new StringWriter xmlSerializer.Serialize stringWriter john string..

Create Excel (.XLS and .XLSX) file from C# [closed]

http://stackoverflow.com/questions/151005/create-excel-xls-and-xlsx-file-from-c-sharp

currently looking at a port of the PEAR PHP library Excel Writer that will allow some pretty good XLS data and formatting and.. that all modern versions of Excel support. The PEAR Excel Writer is here PEAR Excel Writer c# .net excel share improve this.. of Excel support. The PEAR Excel Writer is here PEAR Excel Writer c# .net excel share improve this question You can use a..

Integer handled as reference type when passed into a delegate

http://stackoverflow.com/questions/15302801/integer-handled-as-reference-type-when-passed-into-a-delegate

is what the code looks like. class Program delegate void Writer static void Main string args var writers new List Writer for.. Writer static void Main string args var writers new List Writer for int i 0 i 10 i writers.Add delegate Console.WriteLine i.. i 10 i writers.Add delegate Console.WriteLine i foreach Writer writer in writers writer Obviously the answer I gave was wrong...

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

reader new StreamReader @ C source.xml using StreamWriter writer new StreamWriter @ C target.xml while line reader.ReadLine.. @ C source.xml using StreamWriter writer new StreamWriter @ C target.xml while line reader.ReadLine null if line_number.. writer.WriteLine line line_number But whe I open the Writer the target file get erased it writes the lines but when opened..

C# little endian or big endian?

http://stackoverflow.com/questions/217980/c-sharp-little-endian-or-big-endian

give the choice. The same goes for BinaryReader BinaryWriter. My MiscUtil library has an EndianBitConverter class which allows.. endianness there are similar equivalents for BinaryReader Writer. No online usage guide I'm afraid but they're trivial EndianBitConverter..

Remove empty xmlns=“” after Xml Serialization

http://stackoverflow.com/questions/616328/remove-empty-xmlns-after-xml-serialization

priority Then I use the following to append to my XmlWriter foreach uk.co.andrewrea.SitemapNode node in List XmlSerializerNamespaces.. ns.Add String.Empty String.Empty Serializer.Serialize Writer node ns This works out fine except I am left with an emtpy xmlns.. Anyone any ideas Again I can achieve this using the XmlTextWriter and the XmlDocument but I need to achieve it using the XmlWriter...

How to join 2 or more .WAV files together programatically?

http://stackoverflow.com/questions/6777340/how-to-join-2-or-more-wav-files-together-programatically

string sourceFiles byte buffer new byte 1024 WaveFileWriter waveFileWriter null try foreach string sourceFile in sourceFiles.. byte buffer new byte 1024 WaveFileWriter waveFileWriter null try foreach string sourceFile in sourceFiles using WaveFileReader.. reader new WaveFileReader sourceFile if waveFileWriter null first time in create new Writer waveFileWriter new WaveFileWriter..

Generating a PDF document based on a Microsoft Word Template

http://stackoverflow.com/questions/85404/generating-a-pdf-document-based-on-a-microsoft-word-template

SLOW and EATS memory. You won't be able to use the CutePDF Writer unless you also install MS Word on the server. Yeck. share..

how to write super fast file streaming code in C#?

http://stackoverflow.com/questions/955911/how-to-write-super-fast-file-streaming-code-in-c

SeekOrigin.Begin byte buffer reader.ReadBytes length BinaryWriter writer new BinaryWriter File.OpenWrite dstFile writer.Write.. reader.ReadBytes length BinaryWriter writer new BinaryWriter File.OpenWrite dstFile writer.Write buffer Considering that.. times it is remarkably slow. Is there a way to make the Writer connected directly to the Reader i.e. without actually loading..