Posts

What is IL Code or Intermediate Language code?

IL code is intermediate code or partially compiled code. It is generated by JIT. It is CPU independent code.

What is CLR and Its functionality?

1) Is a heart of .net framework and Its a runtime execution engine 2) Services Provided by CLR –Code management (loading and execution) –Application memory isolation –Verification of type safety –Conversion of IL to native code –Access to metadata (enhanced type information) –Managing memory for managed objects –Enforcement of code access security –Exception handling, including cross-language exceptions –Interoperation between managed code, COM objects, and pre-existing DLLs (unmanaged code and data) –Automation of object layout –Support for developer services

Explain JIT compilation?

JIT is Of 3 types. When the compiler compiles the code and converted to IL code. JIT convert IL code to full machine language code. a) Normal JIT (Default) – It compiles the code at runtime and cached it in memory. It is Not compiled full code at runtime it compiles only required part of the code at that time. b) PreJIT- It uses ngen.exe. In this full compilation at the start and not at runtime. It created compiled code ain exe generated at the first time. c) Echno JIT- In this Code is compiled but not cached because majorly used in mobile devices.

What is managed and unmanaged code?

Managed code is code which runs inside the boundary of CLR. The application which is created from.Net framework language is Managed code and if application not created from.Net framework languages is called Unmanaged code. Unmanaged code is code which does not run inside the boundary of CLR like you call hangout from the .net code the hangout application is unmanaged code because its resource allocation, utilization is not handled by CLR.

What is Namespace in .net?

A namespace is a collection of your classes, enums, interfaces and delegates, events etc. If you want to include some third party functionality to your code you use using statment at the start of program or at the top of programm so it include content inside your class so that you can easily access classes,inte rfaces inside that NameSpace.

Comments In C#.Net

Image
Their are 3 ways to comment in c#. a) Single Line comment ===== use // b) Multi Line comment ======== use /* */ c) XMl document comment ======use ///

How many types or DataType in c#?

Image
Boolean types It returns true and false. Integral types byte,short,int,char,short,ushort,uint,long,ulong Floating Types float and double use to store some precision values String Types to save strings it is used

Types in c#.

Image
Their are mainly 2 types a) Value Types – Integer,double ,enums etc are value types. When a variable is declared using one of the basic, built-in data types or a user-defined structure, it is a value type. A value type stores its contents in memory allocated on the stack . b) Referance Types – Interfaces,arrays,strings,object are reference types. — Initial value for reference type is Null and for value, type is 0 A reference type, such as an instance of a class or an array, is allocated in a different area of memory called the heap. This memory isn’t returned to the heap when a method finishes; its only reclaimed when C# garbage collection system determines it is no longer needed.

Implicit and Explicit Conversion.

Image
a) Implicit conversions: No special syntax is required because the conversion is type safe and no data will be lost. Examples include conversions from smaller to larger integral types, and conversions from derived classes to base classes. b) Explicit conversions (casts): Explicit conversions require a cast operator. Casting is required when information might be lost in the conversion, or when the conversion might not succeed for other reasons. Typical examples include numeric conversion to a type that has less precision or a smaller range, and conversion of a base-class instance to a derived class. c) User-defined conversions: User-defined conversions are performed by special methods that you can define to enable explicit and implicit conversions between custom types that do not have a base class–derived class relationship. For more information, see Conversion Operators. d) Conversions with helper classes: To convert between non-compatible types, such as integers and System.Dat...

What is the difference between int.Parse and int.TryParse method?

Image
a) In int.Parse method takes a string as an input and convert it to an integer value. But if sting which we passing not contains the number and it contains other than that it throws an error ArgumentNullException. b) Int.TryParse method has 2 parameters one is string and other is out parameter. If string is unable to parse it return false flag and this method return type is boolean.