Skip to main content

Posts

Showing posts with the label c#

How can we identify partial classes in C#?

The class declaration with the keyword partial is denoting that the class is a partial class. Physically the partial classes can be available in different files/locations. The C# compiler treat them as a single class at the time of compilation.           public partial class PartialClassExample         {             public void MethodOne( int input)             {                 /// Do something .             }         }         public partial class PartialClassExample         {             public string MethodTwo( string input)             {                 return string .Format( "Hello, {0}" , input);         ...

Difference between VB and C#

Each one language has it's  excellency and assets. VB: VB.Net supporting Event Driven Language. VB.Net has WITH Construct, Which is not in C#. Vb.Net support for Optional Parameters. C#: C Sharp supporting Object Orientation. C Sharp is fully typed language than VB.Net. XML Documentation is generated from source code C Sharp supporting  Operator Overloading. C Sharp supporting this operator. C Sharp supporting Pointer via Unsafe Block. In Dot Net We can share the libraries of languages collaborately in our programming. Dot Net supporting CLR, which helping to use the libraries of all the languages supported by .Net. .Net supporting more than 50 languages. .Net is an Language Independent Development Environment. So that it helping to the developers, coders very effiently. Even the J# developers can use the .Net environment for their development purposes.

CONSTRUCTORS IN C#

Constructors have the same name as the class, and usually initialize the data members of the new object. Constructors allow the programmer to set default values, limit instantiation, and write code that is flexible and easy to read. A constructor that takes no parameters is called a default constructor. Default constructors are invoked whenever an object is instantiated using the new operator and no arguments are provided to new. If a class is not defined with the constructor then the CLR (Common Language Runtime) will provide an implicit constructor which is called as Default Constructor. A class can have any number of constructors provided they vary with the number of arguments that are passed, which is they should have different signatures. Constructors do not return a value. Constructors can be overloaded. If a class is defined with static and Non-static constructors then the privilege will be given to the Non-static constructors. The following are the access modifiers for co...