How does C# avoid needing C++ style header files?

I am new to C# and want to understand its architecture a 
little better.
How does C# avoid needing C++ style header files? 


0
Peter
1/22/2010 1:32:34 PM
dotnet.languages.csharp 1931 articles. 0 followers. Follow

9 Replies
1009 Views

Similar Articles

[PageSpeed] 52

Hello,

By design when you compile some code, metadata are stored as part of the 
generated file allowing to use those classes in a self contained way. It has 
all the needed info built into it.

See :
http://msdn.microsoft.com/en-us/library/xcd8txaw(VS.71).aspx
(Metadata Overview)

--
Patrice


"Peter Olcott" <NoSpam@SeeScreen.com> a �crit dans le message de groupe de 
discussion : t8CdnWMCZcduNcTWnZ2dnUVZ_hudnZ2d@giganews.com...
> I am new to C# and want to understand its architecture a little better.
> How does C# avoid needing C++ style header files?
> 

0
Patrice
1/22/2010 2:55:49 PM
Can a class refer to another class that the compiler has not 
seen yet?
Technically this is referred to as a forward reference. How 
does C# do forward references?

"Patrice" <http://scribe-en.blogspot.com/> wrote in message 
news:ObD49L3mKHA.4644@TK2MSFTNGP06.phx.gbl...
> Hello,
>
> By design when you compile some code, metadata are stored 
> as part of the generated file allowing to use those 
> classes in a self contained way. It has all the needed 
> info built into it.
>
> See :
> http://msdn.microsoft.com/en-us/library/xcd8txaw(VS.71).aspx
> (Metadata Overview)
>
> --
> Patrice
>
>
> "Peter Olcott" <NoSpam@SeeScreen.com> a �crit dans le 
> message de groupe de discussion : 
> t8CdnWMCZcduNcTWnZ2dnUVZ_hudnZ2d@giganews.com...
>> I am new to C# and want to understand its architecture a 
>> little better.
>> How does C# avoid needing C++ style header files?
>>
> 


0
Peter
1/22/2010 5:09:33 PM
Peter Olcott wrote:
> Can a class refer to another class that the compiler has not 
> seen yet?

"Not seen yet" implies an order-restricted compilation step, which 
doesn't happen in C#.

> Technically this is referred to as a forward reference. How 
> does C# do forward references?

C# doesn't do forward references, because there's no need for it to.

Note that in C++, a forward reference works only when the type _is_ 
eventually declared fully in the given compilation unit.  Furthermore, 
that declaration must occur before any other code that actually tries to 
use members of the type.

In C#, compilation takes place in multiple passes, so that all types are 
known before the compiler needs to do anything with them.  Hence, no 
need for forward references.

Pete
0
Peter
1/22/2010 5:45:48 PM
Ah, multiple passes, great, thanks.

"Peter Duniho" <no.peted.spam@no.nwlink.spam.com> wrote in 
message news:uocT8q4mKHA.5524@TK2MSFTNGP05.phx.gbl...
> Peter Olcott wrote:
>> Can a class refer to another class that the compiler has 
>> not seen yet?
>
> "Not seen yet" implies an order-restricted compilation 
> step, which doesn't happen in C#.
>
>> Technically this is referred to as a forward reference. 
>> How does C# do forward references?
>
> C# doesn't do forward references, because there's no need 
> for it to.
>
> Note that in C++, a forward reference works only when the 
> type _is_ eventually declared fully in the given 
> compilation unit.  Furthermore, that declaration must 
> occur before any other code that actually tries to use 
> members of the type.
>
> In C#, compilation takes place in multiple passes, so that 
> all types are known before the compiler needs to do 
> anything with them.  Hence, no need for forward 
> references.
>
> Pete



0
Peter
1/22/2010 6:27:56 PM
On 1/22/2010 8:32 AM, Peter Olcott wrote:
> I am new to C# and want to understand its architecture a
> little better.
> How does C# avoid needing C++ style header files?
>
>

OK, so how come C++ needs header files?  :)

When you answer that, then invert to get why C# doesn't.

-- 
Mike
0
Family
1/22/2010 10:43:49 PM
Family Tree Mike wrote:
> On 1/22/2010 8:32 AM, Peter Olcott wrote:
>> I am new to C# and want to understand its architecture a
>> little better.
>> How does C# avoid needing C++ style header files?
>>
>>
> 
> OK, so how come C++ needs header files?  :)
> 
> When you answer that, then invert to get why C# doesn't.
> 

C# isn't strongly typed?!!!!!! :-)
0
BobF
1/22/2010 11:40:02 PM
"Family Tree Mike" <FamilyTreeMike@ThisOldHouse.com> wrote 
in message news:O0BoYR7mKHA.4392@TK2MSFTNGP05.phx.gbl...
> On 1/22/2010 8:32 AM, Peter Olcott wrote:
>> I am new to C# and want to understand its architecture a
>> little better.
>> How does C# avoid needing C++ style header files?
>>
>>
>
> OK, so how come C++ needs header files?  :)
>
> When you answer that, then invert to get why C# doesn't.
>
> -- 
> Mike

That makes perfect sense to me. 


0
Peter
1/23/2010 4:41:55 AM
"BobF" <nothanks@no.spam> wrote in message 
news:uzu2Hx7mKHA.4648@TK2MSFTNGP06.phx.gbl...
> Family Tree Mike wrote:
>> On 1/22/2010 8:32 AM, Peter Olcott wrote:
>>> I am new to C# and want to understand its architecture a
>>> little better.
>>> How does C# avoid needing C++ style header files?
>>>
>>>
>>
>> OK, so how come C++ needs header files?  :)
>>
>> When you answer that, then invert to get why C# doesn't.
>>
>
> C# isn't strongly typed?!!!!!! :-)

I don't think that this is true. C# can be strongly typed, 
and not require headers by simply making multiple passes. 


0
Peter
1/23/2010 4:42:53 AM
Peter Olcott wrote:
> "BobF" <nothanks@no.spam> wrote in message 
> news:uzu2Hx7mKHA.4648@TK2MSFTNGP06.phx.gbl...
>> Family Tree Mike wrote:
>>> On 1/22/2010 8:32 AM, Peter Olcott wrote:
>>>> I am new to C# and want to understand its architecture a
>>>> little better.
>>>> How does C# avoid needing C++ style header files?
>>>>
>>>>
>>> OK, so how come C++ needs header files?  :)
>>>
>>> When you answer that, then invert to get why C# doesn't.
>>>
>> C# isn't strongly typed?!!!!!! :-)
> 
> I don't think that this is true. C# can be strongly typed, 
> and not require headers by simply making multiple passes. 
> 
> 

It was a funny, Peter ...
0
BobF
1/23/2010 1:12:36 PM
Reply:

Similar Artilces:

need pcx graphics filter for excel 2003
Anyone know where I can find a pcx graphic filter for excel 2003? ...

Help needed on creating a subform
I am trying to create a form that shows quote info, but also has a subform that lists all keywords and allows you to select multiple keywords to associate with that quote. I have never done a subform before and am struggling a little with it as there is an element of indirection involved. Any pointers would be greatly appreciated. A summary of my DB so far is: Keywords: - KeywordID - Keyword Quote: - QuoteID - Quote KeyworkLink: - KeywordFK - QuoteFK Hi Craig, Let me attempt to describe what you want to achieve before saying how. You need a main form bound in some way to your Quote ta...

How to build a project in Visual C++.net developed in Visual C++ 6
Hi, I am Nageshwar. I have developed a project in VC++ 6.0 and OpenGL. I have installed VC++.net in my system. When I compile and build the same code in VC++.net environment, I am getting errors. I have used fstream.h to read and write to files. But this header file is showing errors in VC++.net. I have used iostrea.h header. This is also showing erros. I think I need to use a different version of headers. Please suggest me how to recover from these errors. Which header file I have use instead of fstream.h header? etc., Thanks for all who help me.. Awaiting an early response, Nageshwar ...

Need to use F9 to requery in subform
The data base consists of 2 key tables Scanner Models and Scanner Parts. As this is a many-to-many relationaship and there is a linking table ModelPart. When work is carried out on a Scanner a Service Report is input. The Service Report consists of a main form (recording dates, work done etc, Scanner Model) and a subform (to enter details of parts used). The Service Report number is the Master Link Field and Child Link Field. On entereing a Service Report the Scanner Model is selected from a combo box. On entering the subform and clicking on the PartID combo box a list of ...

Output .lib file name
How can I change output .lib file name? I'm building an DLL and using VC6. I couldn't find it in Project | Settings... Thanks. Hi, You can try to modify your .dll file name, then your .lib file name is also changed. Best Regards! PPDragon "Jan Plastenjak" <none@ms.com> д���ʼ� news:%23AgYZ6NNEHA.3452@TK2MSFTNGP10.phx.gbl... > > How can I change output .lib file name? I'm building an DLL and using > VC6. I couldn't find it in Project | Settings... > > Thanks. > > You can always hand-edit the command line to the linker. As...

Excel trying to open files no longer existing..
I don't know what I did, but now when I open Excel it tries to open 2 or 3 files that no longer exist. How do I stop this? I believe it had something to do with Tools -> Folder Options -> File Types in that area of Explorer, but I can't figure out what to do to make it work fine again. Shawn Give us some more detail. You say Excel "tries to .....". Exactly what do you see that makes you think that is what is happening? If Excel is commanded to open a file that doesn't exist, you will get an error message. Do you get an error message? If y...

How can I access files in 'Personal Folders'?
Question for knowledgeable outlook folks: If I accidentally drag an email into the 'Personal Folders' node on the file tree--not into a subfolder but into Personal Folders it self-- how do I get the email? As far as I can tell it's just gone. Thanks very much for the help. Use Advanced Find on the root of the Personal Folders where you dragged the item - search for all Outlook Items. When found, drag it to the proper folder. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. All unsolicited mail sent to my personal account will ...

How to combine Excel 2002 files and remove duplicate records?
I’ve recently took over a task at my job of managing some Excel files. I am using Excel 2002. There are several Excel files that need to be combined into one file however, if I do this, I will have some duplicate records that I will have to delete. The only way I know how to do this is to copy and paste and then look for duplicate records manually and delete them as I find them. Is there an easier way to do this? Thank you for you support and help. Yes, there is. I would use VBA to do that job, but I need more info. When you say there are duplicate records, exactly what is duplicated? ...

C: Drive documents and setting expansion
Whenever I, Right Click Start then click "Explore", I get an expansion of the my user ID folders. Now, I rarely us "Documents and Settings" and would like to have it expand differently. What do I need to change so that can happen?? Thanks.. Bruce A. Julseth wrote: > Whenever I, Right Click Start then click "Explore", I get an > expansion of the my user ID folders. Now, I rarely us "Documents and > Settings" and would like to have it expand differently. > > What do I need to change so that can happen?? 1. You could ...

fatal error LNK 1104:cannot open file "nafxcwd.lib"
I made everything in "Resolution" of the hotfix but the error appears again and I can't remove it. What I have to do . Please, help me. Thank You in advance. ...

Need help with CDONTS or other object to receive mail in a specific way
Hello, Is it possible to write a script using CONDTS object to read all emails from the SMTP IIS "Drop" folder without changing the username and email address in LogonSMTP? or is there completely another way to do it. Here is what I want exactly the program to do: I just want to have one script that will be able to pickup and read all emails that arrive regardless of the email prefix. For example, I want the script to read: R34DY8@email.com , UH34GR@email.com , VM73G8@email.com in one run. As you notice, the email prefix is a special code that I will want to extract from every emai...

Changing Source excel file causes links in word to fail
I've got a Word document with about 600 links to an excel spreadsheet. Updating the links works fine until the source excel file is changed thenword changes some portion of the links from Unformatted Text to a spreadsheet cell. Changing the links manually or with a macro there are some observed changes in the links. The cells that change are changed from Automatic to Manual and this happens to all of the cells on a single Excel row. There's nothing wrong with the data and the spreadsheet formats are identical. When I go back to the original settings I can change the ...

Sorting Possible avoiding cell Formulas?
Just wanted to know if it is Possible to sort omitting any formul activity? I know, sounds crazy and doesn't make much since, but when I attempt t sort, the data resorts back to the original position based on som formulas I am using. So I guess the main question would be, Is it possible to freeze formul activity to allow general sorting? If Not, I can surely understand Wh ...Thanks In Advance.. -- Mh ----------------------------------------------------------------------- Mhz's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=3598 View this thread: http://www...

Payables transaction file and integration manager
2007 Sep 16 I want to use integration manager to import data from another application to enter payables invoice transaction data. Information will be required for: PM10100 PM Distribution Work File PM10500 PM Tax Work File PM10000 PM Transaction Work File Please let me know if this is correct. Thanks, Jacqueline Chay ...

Create timeline for 2500 B.C. to 100 B.C.?
Visio only allows me to create timeline for after 1900 AD. Can I use Visio to create a timeline for 2500 BC to 100 BC? Visio's Divided timeline has exactly what I need except I can not enter BC as the start and end time. And Visio always require end time to be greater than the start time. Any suggestion on how I can do this in Visio? You're not going to be able to use the timeline because the code is linked to the system clock (only goes back to 1900). You'll have to use the vanilla shapes that come with visio. Al "Little Black Sheep" <Little Bl...

click public folder need me type user name password
hi i using exchange 2003 entperise ,now when i start " exchange system manager " click " administrator groups , and then click Folders Right-click Public Folders, and then click View System Folders but i type all user name & password , also not work also show me type user name & password ( administrator & domain admin ) also like this , how can i solve this problem ? in public folder store , i can see ( logons ,public folder instances , public folders, replication status , full-text indexing ) put when i double click this then show user name & password ...

Saving files onto a network under Win XP
Hi, I've got a bit of a strange problem. We've just moved a users files onto the network and they are now unable to save Microsoft Publisher files. The permissions are correct as they can save excel, word files etc into the same directory but when you try saving publisher it says that the disk is full when it isn't. Thanks Jim wrote: > Hi, > > I've got a bit of a strange problem. We've just moved a users files > onto the network and they are now unable to save Microsoft Publisher > files. The permissions are correct as they can save excel, word files...

recently opened files in the Open section of the Task Pane
Hi, In Excel2003, how can I remove the list of recently opened files in the Open section of the Task Pane? -- Thanks, Jeffrey On Feb 28, 12:42 am, "Jeff Hopkins" <atomic58"NOSPAM"@sc.rr.com> wrote: > Hi, > > In Excel2003, how can I remove the list of recently opened files in the Open > section of the Task Pane? > This is a same list as Recently used files list under File menu. Go to Tools -> Options, and under General tab remove checkmark at Recently used file list. You must restat excel after this to change take effect. -- Regard...

Need help with SQL Query
Hi, I have a table with four fields: Group Under Group Primary Group ===== =========== ============ Sundry Debtors Current Assets Current Assets North Sundry Debtors Current Assets UK North Current Assets So the group Highest Group is Current Assets -> Sundry Debtors -> North -> UK UK comes in North and North comes in Sundry Debtors. Now if I want all Sundry Debtors groups I can run an SQL Query as: s...

Visual C++ to read Strings from Serial Port
Hi. I'm doing a project using Visual C++ to read data from Serial Port. My program needs to do *something* when it receives specific data. For eg, if the program receives "Alarm 1 Zone 4", it will do something. The data received will be variable in length. My questions: 1) Any recommendations for the serial Comm Class for Visual C++? 2) How can i compare the data i receive from serial to the specific messages i'm looking for, eg data types, size of data types, limitations & etc.? Thanks. Any comments are highly appreciated. Leng As far as the serial part goes, it i...

C++ : Is it lots harder than c# and VB
Hi everyone, I learned Java whilst at university and have taught myself c# and VB.net. I think I am ok at it. I was thinking, these languages will probably be bigger in the future so I better get ready for them. But then, I also realised that COM is still quite important and so is C++. So I thought I better just try and have a look at C++ and COM. And now I'm scared. So my question is - why does C++ look so much harder than c#? For example : 1. The methods all have really stupid names that are hard to descern a function from. 2. You need to think about pointers and cleaning up ...

need help with creating football depth chart
On Tue, 5 Aug 2008, in microsoft.public.excel.charting, DAMONO <DAMONO@discussions.microsoft.com> said: >need help with creating football depth chart I've just googled "football depth chart", and they simply look like tables to me, not graphs. Can't you just make a spreadsheet? -- Del Cotter NB Personal replies to this post will send email to del@branta.demon.co.uk, which goes to a spam folder-- please send your email to del3 instead. ...

MFC DLL Calling C# Assembly
I have been trying to get a simple mfc dll I wrote to add to numbers call a C# assembly. Here is a sample of my C++ code in my cpp file. extern "C" _declspec(dllexport) int Calc(int no1,int no2) { //result = no1 + no2; return MangedAdder(no1, no2); } #pragma managed #using <mscorlib.dll> #using <ControllerLibrary.dll> int MangedAdder(int a, int b) { ControllerLibrary::DLLController *t = new ControllerLibrary::DLLController(); return t->AddNumbers(a, b); } All I really need is an extern function in a mfc dll that calls a me...

Offline Backup
Hi, Many thanks to Andy David who has led me thus far. I'm working on an offline restoration of public folder data, according to the KB article http://support.microsoft.com/?ID=296788. At this point, it directs me to dismount the public folder database, make a backup copy, then mount the backed-up copy (see "Backing Up an Exchange Database Offline", step 4). I have copied my backup pub1.edb and pub1.stm files, but am unsure how to mount them (embarrasing, yes). It would appear that I am only able to mount and dismount the original files. How do I direct Exchange to mount ...

create pivot table from external csv file
I am dumping huge data to csv file, Now what I want to do is, create pivot table/chart from csv file without importing data into it. Reason behind doing this is, end user view updated report without messing with thier limited excel knowledge. Hi, So what's your question? If you're asking if it can be done, the answer is Yes. If you're asking how to do it, the question is - what version of Excel are you using? For Example in 2003 you would choose Data, Pivot Table and Pivot Chart Report, and choose External data source, Next, Get Data, choose New Data Source and cl...