Wednesday, January 16, 2013

Microsoft® Certified Professional Developer (MCPD) Web Developer 4


 

  I am glad to share my certification information  “Microsoft® Certified Professional Developer (MCPD) Web Developer 4 by providing you with Transcript ID and Access Code.

 I have completed MCPD Web Developer 4 Certification in this month.

 You can see complete list of Microsoft Certification till now I have completed on below site using Transcript ID and Access Code.


 Transcript ID : 807271
Access Code : abcde12345

Wednesday, December 19, 2012

Format code shortcut for VS2010

Visual Studio WITH C# KEY BINDINGS

To answer the specific question, in C# you are likely to be using the C# keyboard mapping scheme, which will use these hotkeys by default:

Ctrl+E, Ctrl+D to format the entire document.
Ctrl+E, Ctrl+F to format the selection.





Ctrl + K + D (Entire document)
Ctrl + K + F (Selection only)


resharper - Ctrl + Alt + F
VS 2010 - Ctrl + K, Ctrl + D

You can change these in Tools > Options > Environment -> Keyboard (either by selecting a different "keyboard mapping scheme", or binding individual keys to the commands "Edit.FormatDocument" and "Edit.FormatSelection").
If you have not chosen to use the C# keyboard mapping scheme, then you may find the key shortcuts are different. For example, if you are not using the C# bindings, the keys are likely to be:
Ctrl + K + D (Entire document)
Ctrl + K + F (Selection only)
To find out which key bindings apply in YOUR copy of Visual Studio, look in the Edit > Advanced menu - the keys are displayed to the right of the menu items, so it's easy to discover what they are on your system.

These shortcuts (starting with Ctrl+E) are valid for Visual Studio 2005 and 2008 only. Use the shortcuts Ctrl+K+D and Ctrl+K+F to acchive the same in Visual Studio 2010 (if you are using the default configuration).

Yes, you can use the two-chord hotkey (Ctrl+K, Ctrl+F if you're using the General profile) to format your selection.
Other formatting options are under Edit » Advanced, and like all VS commands, you can set your own hotkey via Tools » Options » Environment » Keyboard (the format selection command is called Edit.FormatSelection).
Formatting doesn't do anything with blank lines, but it will indent your code according to some rules that are usually slightly off from what you probably want

 

Wednesday, May 30, 2012

ViewStateMode in ASP.Net 4.0

ViewStateMode in ASP.Net 4.0

When asp.net introduced the concept of viewstate, it changed the way how developers maintain the state for the controls in a web page. Until then to keep the track of the control(in classic asp), it was the developer responsibility to manually assign the posted content before rendering the control again. Viewstate made allowed the developer to do it with ease. The developers are not bothered about how controls keep there state on post back.
Viewstate is rendered to the browser as a hidden variable __viewstate. Since viewstate stores the values of all controls, as the number of controls in the page increases, the content of viewstate grows large. It causes some websites to load slowly.
As developers we need viewstate, but actually we do not want this for all the controls in the page. Till asp.net 3.5, if viewstate is disabled from web.config (using ..), then you can not enable it from the control level/page level. Both <%@ Page EnableViewState=”true”…. and
Lot of developers demands for more control over viewstate. It will be useful if the developers are able to disable it for the entire page and enable it for only those controls that needed viewstate. With ASP.NET 4.0, this is possible, a happy news for the developers. This is achieved by introducing a new property called ViewStateMode.
Let us see, What is ViewStateMode – Is a new property in asp.net 4.0, that allows developers to enable viewstate for individual control even if the parent has disabled it. This ViewStateMode property can contain either of three values
  1. Enabled- Enable view state for the control even if the parent control has view state disabled.
  2. Disabled - Disable view state for this control even if the parent control has view state enabled
  3. Inherit - Inherit the value of ViewStateMode from the parent, this is the default value.
To disable view state for a page and to enable it for a specific control on the page, you can set the EnableViewState property of the page to true, then set the ViewStateMode property of the page to Disabled, and then set the ViewStateMode property of the control to Enabled.
Find the example below.
Page directive - <%@ Page Language="C#"  EnableViewState="True" ViewStateMode="Disabled" .......... %>
Code for the control  -

Now the viewstate will be disabled for the whole page, but enabled for the TextBox.
ViewStateMode gives developers more control over the viewstate.

Tuesday, May 29, 2012

Method Overriding in C#.NET

Method Overriding in C#.NET

Creating a method in derived class with same signature as a method in base class is called as method overriding.

Same signature means methods must have same name, same number of arguments and same type of arguments.

Method overriding is possible only in derived classes, but not within the same class.

When derived class needs a method with same signature as in base class, but wants to execute different code than provided by base class then method overriding will be used.

To allow the derived class to override a method of the base class, C# provides two options, virtual methods and abstract methods.



Monday, May 28, 2012

Improvements in C# 4.0

Improvements in C# 4.0


C# in .NET Framework 4.0 has some more things to offer. These are:
  • Dynamic lookup
  • Named
  • Optional parameters

Dynamic Lookup

There is a new static type named dynamic. We can use it as object of any type. If there is any error on its usage, we would get it on runtime only. For example:
dynamic integerValue = 1; 
dynamic stringValue = " a string"; 
dynamic Result = integerValue + stringValue;
Output of this would be: 1 a string.
But, if you change the last line to:
dynamic Result = integerValue & stringValue;
You will not get any compilation error, but the following error on runtime:
Operator '&' cannot be applied to operands of type 'int' and 'string'

Optional Parameters

To implement optional parameters, we used to create overloaded functions before ASP.NET 4, but now, optional parameters are no more a restriction in C#. Like VB, optional parameters must be mentioned last. For example:
public void FunctionOptionalParam(string Name, int Age, string Country = "") 
and we can call them without mentioning the value for the optional parameter.
FunctionOptionalParam("My Full Name",20);

Named Parameters

Named parameters allow you to ignore the parameter order and mention parameters with names in a different order. For example:
public void FunctionNamedParam(int x, int y , int z)
On function call, it would be:
FunctionNamedParam(x:1, z:3, y:2);
Although we are sending a value for the parameter z before its order in the function declaration, but these would be equal to x=1, y=2, z=3.

Friday, May 25, 2012

Tuesday, May 22, 2012

C# FAQ: abstract class & interface , private constructor

What is abstract class ?
Abstract class is a base class or a parent class. Abstract classes can  have empty abstract methods or it can have implemented methods which can be overridden by child classes.

The next question i expected was on interfaces and yes there it comes.

What are interfaces?
Interface is a contract class with empty methods , properties and functions. Any class which implements the interface has to compulsory implement all the empty methods , functions and properties of the interface.

Now the 1000% sure question was bound to come difference between them...

What's the difference between abstract class and interface?
There are many differences, below are some key two differences :-
  • Abstract class are base class or parent class while interfaces are contracts.
  • Abstract class can have some implemented methods and functions while interfaces methods and functions are completely empty.
  • Abstract classes are inherited while interfaces are implemented.
  • Abstract classes are used when we want to increase reusability in inheritance while interfaces are used to force a contract.

Can we create a object of abstract class or interface?
No we can not.
Now the practical question..

In what scenarios will you use a abstract class and in what scenarios will you use a  interface?
If you want to increase reusability in inheritance then abstract classes are good. If you want implement or force some methods across classes must be for uniformity you can use a interface. So to increase  reusability via inheritance use abstract class as it is nothing but a base class and to force methods use interfaces.

What is the use of private constructor ?

When we declare a class constructor as private , we can not do 2 things:-
-- We can not create a object of the class.
-- We can not inherit the class.
When to use private contstructor ==> when we have some classes like Utilty or Helper Classes Which we referer multiple places and we dont want to create instance of it all the time we call it. only one instance of such class will be used all over  the project.

Popular Posts

Recent Posts

Unordered List

Text Widget