1-)In c# why don't we need header files What does c++ miss.So it needs header file but c# not.
2-)In c++ main() is not in a class.Main() is called by OS.It is a special function.But in C# it is also in a class.For example:
class Exercise
{
static void Main()
{
Console.WriteLine();
}
}
Here this is confusing thing.Why do C# designers force us to put main in a class
Does OS instantinate Example class for calling main().If not what is the magic behind this rule
Thanks.

Why don't we use header file and Main in class
leshan
my first questions answer is metadata.Thanks carlop.
But for main() question i think maybe there can be some different purpose.
OK
Maybe i must ask so:
Also is main() must be in a class for a language that want to be truely oo.
Main is not a member of exercise class above.I can't call it with exercise object.Main is aspecial function so isn't this bad design and confusing design that putting main() in a class
CaptainSmudge
That's a great evolution... Win32 DLLs miss metadata... the C++ header files only contains the prototypes, in .NET all you need is the code DLL since it contains all the metadata needed to consume the types.
_ _ _ _ _ _ _ _
Andy Hough
The real reason the C++ uses header files is because C uses them. And C uses them, because when it was first designed (late 1970s), computer were much slower than they are now, with much less memory. Header files were devised to allow file Abc.C to be interact with the code in Xyz.C without having to read, parse & compile all of file Xyz.c. Only the bare minimum information needed by the compiler about the code in file Xyz.c was placed in the header Xyz.h. and that was used in it's place.
This led to some problems --- the .H & .C files getting out of sync, for example, and it was realized that the compile could generate better code if it had more information about the code in file Xyz.c.