Click here to Skip to main content
15,886,919 members
Home / Discussions / C#
   

C#

 
QuestionC# Media Library Help ! Pin
O.Calderbank27-Apr-12 2:27
O.Calderbank27-Apr-12 2:27 
AnswerRe: C# Media Library Help ! Pin
Richard MacCutchan27-Apr-12 2:42
mveRichard MacCutchan27-Apr-12 2:42 
AnswerRe: C# Media Library Help ! Pin
Wes Aday27-Apr-12 10:03
professionalWes Aday27-Apr-12 10:03 
QuestionDocument opening/saving idiom Pin
Orjan Westin27-Apr-12 1:07
professionalOrjan Westin27-Apr-12 1:07 
AnswerRe: Document opening/saving idiom PinPopular
Pete O'Hanlon27-Apr-12 1:57
mvePete O'Hanlon27-Apr-12 1:57 
AnswerRe: Document opening/saving idiom Pin
PIEBALDconsult27-Apr-12 3:22
mvePIEBALDconsult27-Apr-12 3:22 
AnswerRe: Document opening/saving idiom Pin
Eddy Vluggen27-Apr-12 7:04
professionalEddy Vluggen27-Apr-12 7:04 
AnswerRe: Document opening/saving idiom Pin
OriginalGriff27-Apr-12 9:29
mveOriginalGriff27-Apr-12 9:29 
Yes, a stream would be more normal, although as the others have said, a file path option doesn't hurt.

One of the big strengths of passing a stream rather than a file is that the stream can be encapsulated in the containing class to form a compound document. If you think of your document as an excel sheet, then passing streams enables the excel file to contain a number of encapsulated sheets without your document being aware of it - you can't easily do that with files. Certainly, I would make the commitment to output to file at the highest level I can - if only so that I can easily reuse the lower level components.

foreach is a very, very useful construct: it can't replace a for loop, but it builds on it:
  • If you do not need to know the position of an element in a collection, using a foreach loop makes the code cleaner and easier to read - you aren't creating simple variables unnecessarily.
  • If you do not want the collection to change while you go though it, the a foreach is much better - any attempt to add or remove elements will cause a run time error immediately, rather than waiting until something goes out of range.
  • One of the hardest differences to get used to between C++ and C# is variable naming: gone is Hungarian notation, gone is m_blahblah, g_balhblah, and so forth! I've been using C# almost exclusively for a nuymber of years and I still call Buttons butOK and TextBoxes tbUserName! Laugh | :laugh:
    Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water

    NewsExpand the text in the RichTextBox. Pin
    nqs_vn27-Apr-12 0:10
    nqs_vn27-Apr-12 0:10 
    AnswerRe: Expand the text in the RichTextBox. Pin
    VJ Reddy27-Apr-12 1:16
    VJ Reddy27-Apr-12 1:16 
    GeneralRe: Expand the text in the RichTextBox. Pin
    nqs_vn27-Apr-12 16:40
    nqs_vn27-Apr-12 16:40 
    QuestionSave List with BinaryReader Pin
    larsp77726-Apr-12 23:22
    larsp77726-Apr-12 23:22 
    AnswerRe: Save List with BinaryReader Pin
    Wayne Gaylard26-Apr-12 23:44
    professionalWayne Gaylard26-Apr-12 23:44 
    QuestionWindow Service didn’t run when SQL Server is on Remote Database Pin
    masterprogrammertech26-Apr-12 23:17
    masterprogrammertech26-Apr-12 23:17 
    AnswerRe: Window Service didn’t run when SQL Server is on Remote Database Pin
    PIEBALDconsult27-Apr-12 3:24
    mvePIEBALDconsult27-Apr-12 3:24 
    AnswerRe: Window Service didn’t run when SQL Server is on Remote Database Pin
    charlybones7-May-12 22:17
    charlybones7-May-12 22:17 
    Questionimpresiones en c# Pin
    samuelalvarito26-Apr-12 6:42
    samuelalvarito26-Apr-12 6:42 
    AnswerRe: impresiones en c# Pin
    phil.o26-Apr-12 6:48
    professionalphil.o26-Apr-12 6:48 
    AnswerRe: impresiones en c# Pin
    Abhinav S26-Apr-12 7:02
    Abhinav S26-Apr-12 7:02 
    AnswerRe: impresiones en c# Pin
    jschell28-Apr-12 7:44
    jschell28-Apr-12 7:44 
    Questionspooler en c# Pin
    samuelalvarito26-Apr-12 6:40
    samuelalvarito26-Apr-12 6:40 
    Questioncomo usar el evento drag&drop para cargar documentos office en un formulario de c# Pin
    samuelalvarito26-Apr-12 6:39
    samuelalvarito26-Apr-12 6:39 
    AnswerRe: como usar el evento drag&drop para cargar documentos office en un formulario de c# Pin
    Abhinav S26-Apr-12 6:45
    Abhinav S26-Apr-12 6:45 
    AnswerRe: como usar el evento drag&drop para cargar documentos office en un formulario de c# Pin
    Bernhard Hiller26-Apr-12 21:52
    Bernhard Hiller26-Apr-12 21:52 
    QuestionReleaseComObject() or not? Pin
    __John_25-Apr-12 23:09
    __John_25-Apr-12 23:09 

    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.