Click here to Skip to main content
15,910,787 members
Home / Discussions / C#
   

C#

 
QuestionRethrowing exceptions: Pin
ntfirebird29-Sep-05 16:24
ntfirebird29-Sep-05 16:24 
AnswerRe: Rethrowing exceptions: Pin
Libra29-Sep-05 17:39
Libra29-Sep-05 17:39 
GeneralRe: Rethrowing exceptions: Pin
Dave Everett30-Sep-05 10:10
Dave Everett30-Sep-05 10:10 
QuestionLineScroll method in C# Pin
Member 109769929-Sep-05 16:07
Member 109769929-Sep-05 16:07 
QuestionMdiChild and its control box Pin
AesopTurtle29-Sep-05 16:06
AesopTurtle29-Sep-05 16:06 
QuestionHow to align text in C# Pin
Johny Ng29-Sep-05 15:17
Johny Ng29-Sep-05 15:17 
AnswerRe: How to align text in C# Pin
Jaiprakash M Bankolli29-Sep-05 18:48
Jaiprakash M Bankolli29-Sep-05 18:48 
Questiontextbox.AppendText("just do it!\n"); Pin
Lilli Alexis29-Sep-05 14:45
Lilli Alexis29-Sep-05 14:45 
AnswerRe: textbox.AppendText("just do it!\n"); Pin
mav.northwind29-Sep-05 19:40
mav.northwind29-Sep-05 19:40 
QuestionTreeNode to Clipboard? Pin
PhrankBooth29-Sep-05 13:46
PhrankBooth29-Sep-05 13:46 
QuestionReading IPTC and XMP from JPEG files Pin
codebas29-Sep-05 12:45
codebas29-Sep-05 12:45 
AnswerRe: Reading IPTC and XMP from JPEG files Pin
divina22-Dec-05 20:45
divina22-Dec-05 20:45 
QuestionLoading Divx files Pin
Sasuko29-Sep-05 11:42
Sasuko29-Sep-05 11:42 
Question.NET Code Easy to Disassemble Pin
Heinz_29-Sep-05 10:46
Heinz_29-Sep-05 10:46 
AnswerRe: .NET Code Easy to Disassemble Pin
Dave Kreskowiak29-Sep-05 11:30
mveDave Kreskowiak29-Sep-05 11:30 
GeneralRe: .NET Code Easy to Disassemble Pin
Heinz_29-Sep-05 19:36
Heinz_29-Sep-05 19:36 
AnswerRe: .NET Code Easy to Disassemble Pin
Ashok Dhamija29-Sep-05 15:19
Ashok Dhamija29-Sep-05 15:19 
GeneralRe: .NET Code Easy to Disassemble Pin
Heinz_29-Sep-05 19:43
Heinz_29-Sep-05 19:43 
QuestionFastest way to read XML Pin
tommazzo29-Sep-05 8:39
tommazzo29-Sep-05 8:39 
AnswerRe: Fastest way to read XML Pin
turbochimp29-Sep-05 9:02
turbochimp29-Sep-05 9:02 
Why not just use XML serialization to write the instance to XML (assuming you're able to serialize everything you need to get using XML serialization)?

Example (assuming you wanted to save the XML file to disk):

// Saves the class instance to disk.
string path = @"C:\MyClassInstance.xml";
XmlSerializer serializer = new XmlSerializer(typeof(MyClass));
using(StreamWriter writer = new StreamWriter(path, false))
{
    serializer.Serialize(writer, myInstance); // assumes myInstance is an object of the type MyClass...
    writer.Close();
}

// Loads the class instance XML file from disk and deserializes it
MyClass instance = null;
string path = @"C:\MyClassInstance.xml";
if(File.Exists(path))
{
    XmlSerializer serializer = new XmlSerializer(typeof(MyClass));
    using(StreamReader reader = new StreamReader(path))
    {
        info = serializer.Deserialize(reader) as MyClass;
        reader.Close();
    }
}


That should be pretty fast...


The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

GeneralRe: Fastest way to read XML Pin
tommazzo29-Sep-05 10:51
tommazzo29-Sep-05 10:51 
GeneralRe: Fastest way to read XML Pin
turbochimp29-Sep-05 11:42
turbochimp29-Sep-05 11:42 
GeneralRe: Fastest way to read XML Pin
tommazzo30-Sep-05 4:47
tommazzo30-Sep-05 4:47 
GeneralRe: Fastest way to read XML Pin
turbochimp30-Sep-05 9:31
turbochimp30-Sep-05 9:31 
GeneralRe: Fastest way to read XML Pin
tommazzo30-Sep-05 23:15
tommazzo30-Sep-05 23:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.