Thread: Files?

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    589

    Files?

    I recently started with C# but I can't help wondering about the way you build the program. In C and C++ you create a bunch of different C and H files and use the #include statement to merge them. But in C# it sems like everything is just one huge CS file. Is it always that way or will a different way present itself towards the end of this book?

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    Well, as in C++, sooner or later the compiler will merge it into one big mess. Normally, you should have one file per unit. Each class should have it's own file and each interface or struct, too.

    But that's style, not a compiler requirement. Other people may prefer other styles.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  3. #3
    Registered User CompiledMonkey's Avatar
    Join Date
    Feb 2002
    Location
    Richmond, VA
    Posts
    438
    I also like to seperate my classes. One class per file. In Java I group alike classes in packages. I haven't attempted this in C# yet because my applications have been under 4 classes. It's normal for one of my 2 week projects at work to hit ~50 classes.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Ressources files
    By mikahell in forum Windows Programming
    Replies: 4
    Last Post: 06-19-2006, 06:50 AM
  2. add source files to embedded VC 4.0
    By George2 in forum C++ Programming
    Replies: 4
    Last Post: 06-13-2006, 03:28 AM
  3. *.cpp and *.h files understanding
    By ElastoManiac in forum C++ Programming
    Replies: 4
    Last Post: 06-11-2006, 04:45 AM
  4. Linking header files, Source files and main program(Accel. C++)
    By Daniel Primed in forum C++ Programming
    Replies: 3
    Last Post: 01-17-2006, 11:46 AM
  5. Multiple Cpp Files
    By w4ck0z in forum C++ Programming
    Replies: 5
    Last Post: 11-14-2005, 02:41 PM