Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 22nd, 2005, 07:24 PM
Authorized User
 
Join Date: Apr 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default C# coding style

Hi all,

I have recently moved from C++ to C#. I have seen lot of difference in the coding style of C++ and C#. I am little confused and here are some of questions.

1. What is the equivalent of C++ header file in C#?

2. I am taught in school that all the function prototypes go in header file; the implementations or the methods go into the implementation file (CPP file) and the main function goes into another CPP file and while running the program, you compile, link and execute the program.....So is it not the same in C#? I have seen textbooks just writing the methods and functions within a class in one single file and there is no function prototype....Please Clarify.


Thanks in advance,
Csharplearner
 
Old April 22nd, 2005, 08:54 PM
Authorized User
 
Join Date: Feb 2004
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Separate declaration and implementations are obsolete in modern programming environments. The signature of methods are very easy to view separately in any modern environment, so why specify them separately? C++ had its time, but that time was long ago.


 
Old April 23rd, 2005, 04:17 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

All .NET code in any .NET language can see all public classes that live in the set of files that are compiled together. In Visual Studio.NET you group the files together in a project. VS compiles all those files into a single assembly. In command-line compiling, you have to specify all the files you want compiled to the assembly.

You can reference other assemblies so your code can use classes that live in those other assemblies. When the compiler compiles your code, it will look in all referenced assemblies for classes that you consume in your code. In command-line compiling you must compile each assembly in the necessary order so that you have all the dependant assemblies compiled first. In a VS.NET project, you set up project references to the other projects you'll be using. VS will automatically determine the compile order to satisfy the dependancy requirements.

-Peter
 
Old April 25th, 2005, 12:59 AM
Registered User
 
Join Date: Apr 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi all
  First i say some other thing . my english is very poor---i am a chinese.i have learnt Prammgring 2 year .use c#.above quession i thing i can not answer because i never use c++ before .if you want to make a learnt friend with me ,Please use msn:[email protected].
welcome! how poor my english is ! haha!

 
Old April 26th, 2005, 01:01 PM
Authorized User
 
Join Date: Apr 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you Peter,Doknjas and chinanetwork
 
Old April 27th, 2005, 03:16 PM
Authorized User
 
Join Date: Mar 2005
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to aehb
Default

hello,
   the equivalent of header files of C++ is the "Assemblies" in C#.
no need to split your code to header files and implementation files here. and also the execution of the code starts at the function "Main".





Similar Threads
Thread Thread Starter Forum Replies Last Post
help with coding mastrgamr C++ Programming 15 November 10th, 2006 07:55 AM
coding mdlan PHP Databases 1 May 28th, 2005 07:40 PM
!resolved! - a change in coding style grimmy PHP How-To 1 June 27th, 2004 10:21 AM
can someone help me in coding this? somanchivasu Access 1 April 5th, 2004 02:41 PM
difference between style.visibility and style.disp Mimi Javascript How-To 6 September 17th, 2003 11:50 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.