Tuesday, July 28, 2009

Dot Net CLS .. I have a doubt..?

Thanks for guys who explained me bout basic things about CLR, IL and CLS.. Guys even i knw about all these things. Theoritcally i have also read these things, that CLR wil convert source code to IL . So all language codes will be converted to IL. SInce IL is common , applications can directly use IL. I knw about it. But practically when i was working on Dot net, i came to knw that we cant use VB code in C# . Becas we are declaring initially that this is C# language. So how can we use VB in between the C# code? Also we are having code behind. How can the syntax of C# will work with VB? it gives error right? So how to make CLS here in this situation?

Dot Net CLS .. I have a doubt..?
In the .Net Framework, there is a Microsoft.CSharp.Compilers namespace that contains a CSharpCodeProvider, this object compiles C# into IL. That object does not know how to process VB code. There is a Microsoft.VisualBasic.Compilers object, VisualBasicCodeProvider, that does this. So long as a given file is in 1 language only, these objects can convert the code to IL. Then an assembly generator can put it together. In theory, you could do half a project in C#, half in VB.net and compile them all together, but Visual Studio does not allow you to do this. In Asp.net the code behind each page can be in either language because a page directive specifies the language.
Reply:thanks for the 2 points


No comments:

Post a Comment