Month: January 2014

Access modifiers in C#

Posted on Updated on

List of Access Modifiers in C#:

Public: When Members of a class are declared as public, then they can be accessed

1. Within the class in which they are declared.
2. Within the derived classes of that class available within the same assembly.
3. Outside the class within the same assembly.
4. Within the derived classes of that class available outside the assembly.
5. Outside the class outside the assembly.

Internal: When Members of a class are declared as internal, then they can be accessed

1. Within the class in which they are declared.
2. Within the derived classes of that class available within the same assembly.
3. Outside the class within the same assembly.

Protected: When Members of a class are declared as protected, then they can be accessed

1. Within the class in which they are declared.
2. Within the derived classes of that class available within the same assembly.
3. Within the derived classes of that class available outside the assembly.

Protected internal: When Members of a class are declared as protected internal, then they can be accessed

1. Within the class in which they are declared.
2. Within the derived classes of that class available within the same assembly.
3. Outside the class within the same assembly.
4. Within the derived classes of that class available outside the assembly.

Private: Private members of a class are completely restricted and are accessible only within the class in which they are declared.

References:-
http://msdn.microsoft.com/en-us/library/wxh6fsc7.aspx
http://msdn.microsoft.com/en-us/library/ms173121.aspx

Box Model in CSS

Posted on Updated on

The term “Box Model ” is used when we are talking about design and layout .

In CSS, all the HTML contents are considered as boxes

It consists of :-

1. Margin

2. Border

3. Padding

4. Content

Find the reference image below:-

Box model image

· Margin – Clears area around the border. The margin does not have a background color, it is completely transparent

· Border – Border goes around the padding and content. The border is inherited from the color property of the box

· Padding – Clears an area around the content. The padding is affected by the background color of the box

· Content – The content of the box, which is actual content

· To set the width and height of an element correctly in all browsers, you need to know how the box model works.

Note: When you set the width and height properties of an element with CSS, you just set the width and height of the content area. To calculate the full size of an element, you must also add the padding, borders and margins.

Example:

The total width of the element in the example below is 200px:

Calculation:
150px (width)
+ 20px (left + right padding)
+ 10px (left + right border)
+ 20px (left + right margin)
= 200px

CodeLens in VisualStudio 2013

Posted on

CodeLens is a feature that will be available only in Visual Studio Ultimate edition (more on the controversy here), but adds some very useful behavior to the editor. By default, the number of times a property or method is referenced by your code is shown above that property or method. This information can be helpful when changing existing code, since you’ll know if the method is called from many places or just a handful. In larger projects, especially ones where you’re not familiar with the entire codebase, this can be a big time saver. The number of references is shown in a small font above each property or method on your class, as shown in below figure. Clicking on the number of references will show you all of the methods that call it, making it easy to find and navigate to those sections of your code.

CodeLens in VusalStudio image
CodeLens
CodeLens without TFS integration shows you the number of times a bit of code is referenced.
While not shown here, CodeLens also has some nice Team Foundation Server (TFS) integration. If you’re using TFS, it will allow you to see commit history and unit tests targeting the code in question.

Difference between == and === in javascript

Posted on Updated on

(==) will try to convert the values to the same type before the condition gets evaluated.

ex:-
5==’5′ —-> TRUE
null==undefined —-> TRUE
undefined==undefined —-> TRUE

(===) will not try to convert the values . this operator will check with data type as well.

ex:-
5===’5′ —-> FALSE
null===undefined —-> FALSE
undefined===undefined —-> TRUE