Doubt about .net program execution flow
for few year i am working as a develop but i have lack of knowledge for how C# win or web apps run. when we run application from IDE then how compiler come into scene to compile our program and after then how program start....how CLR come into scene and how JIT come into scene. who take control over the entry point of program. who invoke program entry point so called static void Main() from outside like. how CLR involve to take the responsibility for executing the program & Who involve the CLR. how JIT involve and who involve the JIT. why the entry point is static void main() ?
lot of book help us to write code with C# but never talk about the program execution flow....how a .net program is running. when we click on any .net exe then how exe is getting run. so i have some doubt....if possible then please discuss the above issue in detail or point me towards right article.
Doubt about OOPS
1) i saw a class which was private but constructor was public....why...what does it mean. is there any special purpose that is why class is designed like this.
2) i saw public class but it has three constructor one was private, one was static and last one was public......is there any special purpose to design a class in this way.
3) static class always have static constructor?
4) if a public class has normal constructor along with static constructor then what will be the purpose.
if possible then please discuss the above OOPS issue in details........thanks
when we run application from IDE then how compiler come into scene to compile our program
The IDE starts the compiler and passes it your program. The compiler is another program. It doesn't need special invocation. You can do it yourself without an IDE by just calling csc.exe
directly.
and after then how program start....how CLR come into scene and how JIT come into scene. who take control over the entry point of program. who invoke program entry point so called static void Main() from outside like. how CLR involve to take the responsibility for executing the program & Who involve the CLR. how JIT involve and who involve the JIT.
The JIT is the dynamic IL-to-native compiler. It's what translates the IL that .NET languages are compiled into so that the programs can actually run.
The CLR is pretty much another world for the JIT in the way you're using it. I'm not going to go into detail here, but you can find out more on MSDN.
why the entry point is static void main() ?
Convention. Why is the language called C#?
i saw a class which was private but constructor was public....why...what does it mean. is there any special purpose that is why class is designed like this.
It's so that the private class can be instantiated from the outer class. For example:
public class A {
private something = new B();
private class B {
public B() {
// ...
}
}
}
If the constructor weren't public
, the private
class could not be instantiated by the outer class.
i saw public class but it has three constructor one was private, one was static and last one was public......is there any special purpose to design a class in this way.
Sure. They all do different things. It's not so unusual.
static class always have static constructor?
No. Static constructors are actually very rare. Of course, a static class cannot have a normal constructor.
if a public class has normal constructor along with static constructor then what will be the purpose.
The normal constructor is called to initialize an object. The static constructor is called the first time the class is used. Just because a class has both doesn't make it special, you could use that functionality for just about anything.