Posts

Showing posts from April, 2018

OOPS (Object Oriented Programming) Properties

OOPS (Object Oriented Programming) properties Encapsulation – The programmer can hind the data and function in class from other classes. It is accomplished through assess modifier. Abstraction – Allow us to define a common definition of a base class that multiple derived classes can share. Abstract class is the example of this property Polymorphisms – One interface with many different forms. There are 2 types of polymorphisms. ·          Compile Time – Function and operator overloading ·          Run Time – Inheritance & virtual function Inheritance – Class includes the properties of another class.  It represents the relationship between two classes where one type drives the functionality of second type. Classes – Primary building blocks of OOPs. It also serves as a templet that describe property, methods etc. Object – Object is an instance of a class in OOP. It can be a ...

UML(Unified Modeling Language)

UML (Unified Modeling Language) – Consist of boxes representing classes. Each box has 3 parts (Top, Middle and Bottom).                 Top Part – Class/Package name Middle Part – Class variables (+ Sign ->Public, - Sign ->Private, # Sign -> Protected) Bottom Part – List of Methods UML Relationships Association – Is a structural relationship between two modal elements that shows that objects of one classifier connect and can navigate to objects of other classifier. Let’s take an example of doctor and patient relationship. A doctor can associated with multiple patients and same time a patient can visit multiple doctors. Each of these objects has their own life cycle and there is no owner. Aggregation – It’s an association between the objects in which the objects has their own life cycle but there exists an ownership as well. As an example an employee may belongs to multiple department ...

Extension Methods in C#

Image
Extension Method          These are the special kind of methods those allows us to add methods to existing types without modifying the original types How we can write the Extension Methods           Few things we have to remember before we write a extension method 1. The wrapper class under which we declare the extension methods should be static class 2. Method should be static method Lets get started In this post I am going to add an extension method under string type. Step 1 Write extension class     public static class ExtensionStringMethods     {         public static string GetAllUpperCase(this string obj)         {             return (obj.ToString().ToUpper());         }     } Step 2 Call extension methods         private void GetUpper(string strInput)     ...