Pages

Saturday, December 31, 2011

Sharepoint 2010 - Interview Questions with Answers

What is a Run-Time data table?

The test results tree also includes the table-shaped icon that displays the run-time data table-a table that shows the values used to run a test containing data table parameters or the data table output values retrieved from a application under test

What are the two base classes a WebPart you are going to use within SharePoint 2007 can inherit from?

There are two base classes that a WebPart which is going to be consumed by SharePoint can inherit from, either the SharePoint WebPart Base class or the ASP.NET 2.0 WebPart base class. When inheriting from the SharePoint WebPart Base class your derived WebPart class will inherit from Microsoft.SharePoint.WebPartPages.WebPart. When inheriting from the ASP.NET 2.0 WebPart base class your derived WebPart class will inherit from System.Web.UI.WebControls.WebParts.WebPart. It is considered good practice to use the ASP.NET WebPart base class since the old base class is meant for backwards compatibility with previous version of SharePoint, however there are four exception when it is better to leverage functionality from the SharePoint WebPart base class: Cross page connections Connections between Web Parts that are outside of a Web Part zone Client-side connections (Web Part Page Services Component) Data caching infrastructure

What are the differences between the two base classes and what are the inherit benefits of using one over another?

The difference is the Microsoft.SharePoint.WebPartPages.WebPart base class is meant for backward compatibility with previous versions of SharePoint. The benefit of using the SharePoint WebPart base class is it supported: Cross page connections Connections between Web Parts that are outside of a Web Part zone Client-side connections (Web Part Page Services Component) Data caching infrastructure ASP.NET 2.0 WebParts are generally considered better to use because SharePoint is built upon the ASP.NET 2.0 web architecture. Inheriting from the ASP.NET 2.0 base class offers you features that inherit to ASP.NET 2.0, such as embedding resources as opposed to use ClassResources for deployment of said types.

What is the GAC?

The GAC stands for the global assembly cache. It is the machine wide code cache which will give custom binaries place into the full trust code group for SharePoint. Certain SharePoint assets, such as Feature Receivers need full trust to run correctly, and therefore are put into the GAC. You should always try to avoid deployment to the GAC as much as possible since it will possibly allow development code to do more than it was intended to do.

What is strong naming (signing) a WebPart assembly file mean?

Signing an assembly with a strong name (a.k.a strong naming) uses a cryptographic key pair that gives a unique identity to a component that is being built. This identity can then be referred throughout the rest of the environment. In order to install assemblies into the GAC, they must be strongly named. After signing, the binary will have a public key token identifier which can be use to register the component in various other places on the server.
What are safe controls, and what type of information, is placed in that element in a SharePoint web.config file?

When you deploy a WebPart to SharePoint, you must first make it as a safe control to use within SharePoint in the web.config file. Entries made in the safe controls element of SharePoint are encountered by the SharePointHandler object and will be loaded in the SharePoint environment properly, those not will not be loaded and will throw an error. In the generic safe control entry (this is general, there could be more), there is generally the Assembly name, the namespace, the public key token numeric, the typename, and the safe declaration (whether it is safe or not). There are other optional elements.

What is the CreateChildControls() method? How can you use it to do something simple like displaying a Label control?

The CreateChildControls method in WebParts is used to notify the WebPart that there are children controls that should be output for rendering. Basically, it will add any child ASP.NET controls that are called instantiating each control with its relevant properties set, wire any relevant event handlers to the control, etc. Then the add method of the control class will add the control to the controls collection. In the relevant WebPart render method, the EnsureChildControls method can be called (or set to false if no child controls should be called) to ensure that the CreateChildControls method is run. When using CreateChildControls it implies that your WebPart contains a composition of child controls. In order to create something like a label control in Create, you would create a new label control using the new keyword, set the various properties of the control like Visible=True and ForeColor = Color.Red, and then use Controls.Add(myLabelControl) to add the control to the controls collection. Then you can declare EnsureChildControls in the Render method of the WebPart.

What does the RenderContents method do in an ASP.NET 2.0 WebPart?

The render contents method will render the WebPart content to the writer, usually an HtmlTextWriter since WebParts will output to an HTML stream. RenderContents is used to tell how the controls that are going to be displayed in the WebPart should be rendered on the page. *** Side Question: I got asked what the difference between CreateChildControls and the RenderContents method. The CreateChildControls method is used to add controls to the WebPart, and the RenderContents method is used to tell the page framework how to render the control into HTML to display on a page.

What is the WebPartManager sealed class? What is its purpose?

The WebPartManager sealed class is responsible for managing everything occurring on a WebPart page, such as the WebParts (controls), events, and misc. functionality that will occur in WebPartZones. For example, the WebPartManager is responsible for the functionality that is provided when you are working with moving a WebPart from WebPartZone to WebPartZone. It is known as the “the central class of the Web Part Control Set.” *** Side Question: I got asked how many WebPartManager controls should be on a page. In order to have WebParts on a page there has to be just one WebPartManager control to manage all the WebParts on the page.

What is a SPSite and SPWeb object, and what is the difference between each of the objects?

The SPSite object represents a collection of sites (site collection [a top level sites and all its subsites]). The SPWeb object represents an instance SharePoint Web, and SPWeb object contains things like the actual content. A SPSite object contains the various subsites and the information regarding them.

How would you go about getting a reference to a site?

Select For Unformatted Code C#: 1. oSPSite = new SPSite("http:/server"); 2. oSPWeb = oSPSite.OpenWeb();

What does a SPWebApplication object represent?

The SPWebApplication objects represents a SharePoint Web Application, which essentially is an IIS virtual server. Using the class you can instigate high level operations, such as getting all the features of an entire Web Application instance, or doing high level creation operations like creating new Web Applications through code.

Would you use SPWebApplication to get information like the SMTP address of the SharePoint site?

Yes, since this is a Web Application level setting. You would iterate through each SPWebApplication in the SPWebApplication collection, and then use the appropriate property calls (OutboundMailServiceInstance) in order to return settings regarding the mail service such as the SMTP address. Side Question: I got asked if there are other ways to send emails from SharePoint. The answer is yes, there is. You can use the SendMail method from the SPutility class to send simple emails, however it is not as robust as using the System.Net.Mail functionality since it doesn’t allow things like setting priorities on the email.

How do you connect (reference) to a SharePoint list, and how do you insert a new List Item?

Select For Unformatted Code C#: 1. using(SPSite mySite = new SPSite("yourserver")) 2. { 3. using(SPWeb myWeb = mySite.OpenWeb()) 4. { 5. SPList interviewList = myWeb.Lists["listtoinsert"]; 6. SPListItem newItem = interviewList.Items.Add(); 7. 8. newItem["interview"] = "interview"; 9. newItem.Update(); 10. } 11. }
How would you loop using SPList through all SharePont List items, assuming you know the name (in a string value) of the list you want to iterate through, and already have all the site code written?

Select For Unformatted Code C#: 1. SPList interviewList = myWeb.Lists["listtoiterate"]; 2. foreach (SPListItem interview in interviewList) 3. { 4. // Do Something 5. }

Do you return SharePoint List items using SharePoint web services?

In order to retrieve list items from a SharePoint list through Web Services, you should use the lists.asmx web service by establishing a web reference in Visual Studio. The lists.asmx exposes the GetListItems method, which will allow the return of the full content of the list in an XML node. It will take parameters like the GUID of the name of the list you are querying against, the GUID of the view you are going to query, etc. Side Question: I got asked how I built queries with the lists.asmx web service. In order to build queries with this service, one of the parameters that the GetListItems method exposes is the option to build a CAML query. There are other ways to do this as well, but that was how I answered it.

When retrieving List items using SharePoint Web Services, how do you specify explicit credentials to be passed to access the list items?

In order to specify explicit credentials with a Web Service, you generally instantiate the web service, and then using the credentials properties of the Web Service object you use the System.Net.NetworkCredential class to specify the username, password, and domain that you wish to pass when making the web service call and operations. *** Side Question: I got asked when you should state the credentials in code. You must state the credentials you are going to pass to the web service before you call any of the methods of the web service, otherwise the call will fail.

What is CAML, and why would you use it?

CAML stands for Collaborative Application Markup Language. CAML is an XML based language which provides data constructs that build up the SharePoint fields, view, and is used for table definition during site provisioning. CAML is responsible for rending data and the resulting HTML that is output to the user in SharePoint. CAML can be used for a variety of circumstances, overall is used to query, build and customize SharePoint based sites. A general use would be building a CAML query in a SharePoint WebPart in order to retrieve values from a SharePoint list.

What is impersonation, and when would you use impersonation?

Impersonation can basically provide the functionality of executing something in the context of a different identity, for example assigning an account to users with anonymous access. You would use impersonation in order to access resources on behalf of the user with a different account, that normally, that wouldn’t be able to access or execute something.

What is the IDesignTimeHtmlProvider interface, and when can you use it in WebParts?

The IDesignTimeHtmlProvider interface uses the function GetDesignTimeHtml() which can contain your relevant render methods. It was helpful to use in 2003 since it allowed your WebPart to have a preview while a page was edited in FrontPage with the Webpart on it, because the GetDesignTimeHtml() method contains the HTML for the designer to render.

What are WebPart properties, and what are some of the attributes you see when declaring WebPart properties in code?

WebPart properties are just like ASP.NET control properties, they are used to interact with and specify attributes that should be applied to a WebPart by a user. Some of the attributes you see with ASP.NET 2.0 properties are WebDescription, WebDisplayName, Category, Personalizable, and WebBrowsable. Although most of these properties come from the System.Web.UI.WebControls.WebParts class, ones like Category come out of System.ComponentModel namespace.

Why are properties important in WebPart development, and how have you exploited them in past development projects? What must each custom property have?

Properties are important because WebParts allow levels of personalization for each user. WebPart properties make it possible for a user to interact, adjust, and increase overall experience value with the programmatic assets that you develop without having the need to use an external editor or right any code. A very simple example of exploiting a property would be something like allowing the user to change the text on the WebPart design interface so that they can display whatever string of text they desire. Each custom property that you have must have the appropriate get and set accessor methods.

What are ClassResources? How do you reference and deploy resources with an ASP.NET 2.0 WebPart?

ClassResources are used when inheriting from the SharePoint.WebPart.WebPartPages.WebPart base class, and are defined in the SharePoint solution file as things that should be stored in the wpresources directory on the server. It is a helpful directory to use in order to deploy custom images. In ASP.NET 2.0, typically things such as images are referenced by embedding them as resources within an assembly. The good part about ClassResources is they can help to eliminate recompiles to change small interface adjustments or alterations to external JavaScript files.

What is a SharePoint Solution File? How does it differ from WebPart .cab files in legacy development? What does it contain?

A SharePoint solution file is essentially a .cabinet file with all a developers ustom componets suffixed with a .wsp extension that aids in deployment. The big difference with SharePoint solution files is is that a solution: allows deployment to all WFE’s in a farm is highly manageable from the interface allowing deployment, retraction, and versioning Can package all types of assets like site definitions, feature definitions (and associated components), Webparts, etc. Can provide Code Access Security provisioning to avoid GAC deployments Just to name a few things…

What is a .ddf file and what does it have to do with SharePoint Solution creation?

A .ddf file is a data directive file and is used when building the SharePoint solution bundle specifying the source files and their destination locations. The important thing for someone to understand is that the .ddf file will be passed as a parameter to the MAKECAB utility to orchestrate construction of the SharePoint solution file.

What file does a SharePoint solution package use to orchestrate (describe) its packaged contents?

The solution Manifest.XML file.

What deployment mechanism can you use to instigate Code Access Security attributes for your WebParts?

SharePoint solution files can add in order to handle code access security deployment issues. This is done in the element in the SharePoint solution manifest.XML, which makes it easier to get assemblies the appropriate permissions in order to operate in the bin directory of the web application.

What is a SharePoint Feature? What files are used to define a feature?

A SharePoint Feature is a functional component that can be activated and deactivate at various scopes throughout a SharePoint instances, such as at the farm, site collection, web, etc. Features have their own receiver architecture, which allow you to trap events such as when a feature is installing, uninstalling, activated, or deactivated. They are helpful because they allow ease of upgrades and versioning. The two files that are used to define a feature are the feature.xml and manifest file. The feature XML file defines the actual feature and will make SharePoint aware of the installed feature. The manifest file contains details about the feature such as functionality. Side Question: I got asked how the introduction of features has changed the concept of site definitions. SharePoint features are important when understanding the architecture of site definitions, since the ONET.XML file has been vastly truncated since it has several feature stapled on it.

What types of SharePoint assets can be deployed with a SharePoint feature?

Features can do a lot. For example, you could deploy Simple site customizations Custom site navigation WebParts pages list types list instances event handlers workflows custom actions just to name a few….

What are event receivers?

Event receivers are classes that inherit from the SpItemEventReciever or SPListEventReciever base class (both of which derive out of the abstract base class SPEventRecieverBase), and provide the option of responding to events as they occur within SharePoint, such as adding an item or deleting an item.
When would you use an event receiver?

Since event receivers respond to events, you could use a receiver for something as simple as canceling an action, such as deleting a document library by using the Cancel property. This would essentially prevent users from deleting any documents if you wanted to maintain retention of stored data.

What base class do event receivers inherit from?

Event receivers either inherit from the SPListEventReciever base class or the SPItemEventReciever base class, both which derive from the abstract base class SPEventReceiverBase.

If I wanted to not allow people to delete documents from a document library, how would I go about it?

You would on the ItemDeleting event set: properties.Cancel= true.

What is the difference between an asynchronous and synchronous event receivers?

An asynchronous event occurs after an action has taken place, and a synchronous event occurs before an action has take place. For example, an asynchronous event is ItemAdded, and its sister synchronous event is ItemAdding.

could you append a string to the title of a site when it is provisioned?

In the OnActivated event: Select For Unformatted Code C#: 1. SPWeb site = siteCollection.RootWeb; 2. site.Title += "interview"; 3. site.Update();

Can an event receiver be deployed through a SharePoint feature?

Yes.

What is a content type?

A content type is an information blueprint basically that can be re-used throughout a SharePoint environment for defining things like metadata and associated behaviors. It is basically an extension of a SharePoint list, however makes it portable for use throughout an instance regardless of where the instantiation occurs, ergo has location independence. Multiple content types can exist in one document library assuming that the appropriate document library settings are enabled. The content type will contain things like the metadata, listform pages, workflows, templates (if a document content type), and associated custom written functionality.

Can a content type have receivers associated with it?

Yes, a content type can have an event receiver associated with it, either inheriting from the SPListEventReciever base class for list level events, or inheriting from the SPItemEventReciever base class. Whenever the content type is instantiated, it will be subject to the event receivers that are associated with it.

What two files are typically (this is kept generally) included when developing a content type, and what is the purpose of each?

There is generally the main content type file that holds things like the content type ID, name, group, description, and version. There is also the ContentType.Fields file which contains the fields to include in the content type that has the ID, Type, Name, DisplayName, StaticName, Hidden, Required, and Sealed elements. They are related by the FieldRefs element in the main content type file.

What is an ancestral type and what does it have to do with content types?

An ancestral type is the base type that the content type is deriving from, such as Document (0x0101). The ancestral type will define the metadata fields that are included with the custom content type.

Can a list definition be derived from a custom content type?

Yes, a list definition can derive from a content type which can be seen in the schema.XML of the list definition in the element.

When creating a list definition, how can you create an instance of the list?

You can create a new instance of a list by creating an instance.XML file.

What is a Field Control?

Field controls are simple ASP.NET 2.0 server controls that provide the basic field functionality of SharePoint. They provide basic general functionality such as displaying or editing list data as it appears on SharePoint list pages.

What base class do custom Field Controls inherit from?

This varies. Generally, custom field controls inherit from the Microsoft.SharePoint.WebControls.BaseFieldControl namespace, but you can inherit from the default field controls.

What is a SharePoint site definition? What is ghosted (uncustomized) and unghosted (customized)?

SharePoint site definitions are the core set of functionality from which SharePoint site are built from, building from the SiteTemplates directory in the SharePoint 12 hive. Site definitions allow several sites to inherit from a core set of files on the file system, although appear to have unique pages, thereby increasing performance and allowing changes that happen to a site propagate to all sites that inherit from a site definition. Ghosted means that when SharePoint creates a new site it will reference the files in the related site definition upon site provisioning. Unghosted means that the site has been edited with an external editor, and therefore the customizations are instead stored in the database, breaking the inheritance of those files from the file system.

How does one deploy new SharePoint site definitions so that they are made aware to the SharePoint system?

The best way to deploy site definitions in the SharePoint 2007 framework is to use a SharePoint solution file, so that the new site definition is automatically populated to all WFE’s in the SharePoint farm.

How do I make my site non-restricted?

If you want your site to have anonymous access enabled (i.e., you want to treat it like any site on the Internet that does not ask you to provide a user name and password to see the content of the site), follow these simple steps:

1. Login as an administrator
2. Click on site settings
3. Click on Go to Site Administration
4. Click on Manage anonymous access
5. Choose one of the three conditions on what Anonymous users can access:

o Entire Web site
o Lists and libraries
o Nothing

Can I get domain name for my Web site?

Unfortunately, no. At this point, we don't offer domain names for SharePoint sites. But very soon we will be making this available for all our SharePoint site customers. Please keep checking this page for further update on this. Meanwhile, we suggest you go ahead and set up your site and create content for it.

What are picture libraries?

Picture libraries allow you to access a photo album and view it as a slide show or thumbnails or a film strip. You can have separate folder for each event, category, etc

What are the advantages of a hosted SharePoint vs. one that is on an in-house server?

No hardware investment, i.e. lower costs
• No software to download - ready to start from the word go
• No IT resources - Anyone who has used a Web program like Hotmail can use it
• Faster deployment

Can I ask users outside of my organization to participate in my Windows SharePoint Services site?

Yes. You can manage this process using the Administration Site Settings. Simply add users via their e-mail alias and assign permissions such as Reader or Contributor.

Are there any IT requirements or downloads required to set up my SharePoint site?

No. You do not need to download any code or plan for any IT support. Simply complete the on-line signup process and provide us your current and correct email address. Once you have successfully signed up and your site has been provisioned, we will send a confirmation to the email address you provided.

I am located outside of the United States. Are there any restrictions or requirements for accessing the Windows SharePoint Services?

No. There are no system or bandwidth limitations for international trial users. Additionally language packs have been installed which allow users to set up sub-webs in languages other than English. These include: Arabic, Danish, Dutch, Finnish, French, German, Hebrew, Italian, Japanese, Polish, Portuguese (Brazilian), Spanish and Swedish.

Are there any browser recommendations?

Yes. Microsoft recommends using the following browsers for viewing and editing Windows SharePoint Services sites: Microsoft Internet Explorer 5.01 with Service Pack 2, Microsoft Internet Explorer 5.5 with Service Pack 2, Internet Explorer 6, Netscape Navigator 6.2 or later.

What security levels are assigned to users?

Security levels are assigned by the administrator who is adding the user. There are four levels by default and additional levels can be composed as necessary.
• Reader - Has read-only access to the Web site.
• Contributor - Can add content to existing document libraries and lists.
• Web Designer - Can create lists and document libraries and customize pages in the Web site.
• Administrator - Has full control of the Web site.

How secure are Windows SharePoint Services sites hosted by Microsoft?

Microsoft Windows SharePoint Services Technical security measures provide firewall protection, intrusion detection, and web-publishing rules. The Microsoft operation center team tests and deploys software updates in order to maintain the highest level of security and software reliability. Software hot-fixes and service packs are tested and deployed based on their priority and level of risk. Security related hot-fixes are rapidly deployed into the environment to address current threats. A comprehensive software validation activity ensures software stability through regression testing prior to deployment.

What is the difference between an Internet and an intranet site?

An internet site is a normal site that anyone on the internet can access (e.g., www.msn.com, www.microsoft.com, etc.). You can set up a site for your company that can be accessed by anyone without any user name and password. The internet is used for public presence and a primary marketing tool managed typically by web programmers and a system administrator.

An intranet (or internal network), though hosted on a Web site, can only be accessed by people who are members of a specific network. They need to have a login and password that was assigned to them when they were added to the site by the site administrator. The intranet is commonly used as an internal tool for giving employees access to company information. Content is driven by business relevance, business rules and has increasingly become a common tool in larger organizations. An intranet is becoming more and more the preferred method for employees to interact with each other and the central departments in an organization, whether or not the organization has a Web presence.

What is a workspace?

A site or workspace is when you want a new place for collaborating on Web pages, lists and document libraries. For example, you might create a site to manage a new team or project, collaborate on a document or prepare for a meeting.

What are the various kinds of roles the users can have?

A user can be assigned one of the following roles
• Reader - Has read-only access to the Web site.
• Contributor - Can add content to existing document libraries and lists.
• Web Designer - Can create lists and document libraries and customize pages in the Web site.
• Administrator - Has full control of the Web site.

Can more than one person use the same login?

If the users sharing that login will have the same permissions and there is no fear of them sharing a password, then yes. Otherwise, this is discouraged.

How customizable is the user-to-user access?

User permissions apply to an entire Web, not to documents themselves. However, you can have additional sub webs that can optionally have their own permissions. Each user can be given any of four default roles. Additional roles can be defined by the administrator.

Can each user have access to their own calendar?

Yes there are two ways to do this,
• by creating a calendar for each user, or
• by creating a calendar with a view for each user

How many files can I upload?

There is no restriction in place except that any storage consumed beyond that provided by the base offering may have an additional monthly charge associated with them.

What types of files can I upload / post to the site?

The only files restricted are those ending with the following extensions: .asa, .asp, .ida, .idc, .idq. Microsoft reserves the right to add additional file types to this listing at any time. Also, no content that violates the terms of service may be uploaded or posted to the site.

Can SharePoint be linked to an external data source?

SharePoint data can be opened with Access and Excel as an external data source. Thus, SharePoint can be referenced as an external data source. SharePoint itself cannot reference an external data source.

Can SharePoint be linked to a SQL database?

SharePoint 2007 Portal Server (MOSS2K7) allows connections to SQL based datasources via the Business Data Catalog (BDC). The BDC also allows connecting to data via Web Services.

Monday, October 31, 2011

.Net Remoting - Interview Questions with Answers

What’s a Windows process?

It’s an application that’s running and has been allocated memory in the system.

What do you mean by a Windows process in regards to memory allocation?

Each process is allocated its own address space typically 4GB in which it can run. No other process can interfere in that address space.
If the process crashes, it dies alone without taking the entire OS or a bunch of other applications down.

What is the relationship between a Process, Application Domain, and Application?

A process is an instance of a running application. An application is an executable in the computer. There can be numerous processes launched of the same application (5 copies of Word running), but 1 process can run just 1 application. Hence, Process is a running instance of the application.

How to decide which to use .NET Remoting or ASP.NET Web Services?

Remoting is a more efficient communication exchange when you can control both ends of the application involved in the communication process. Remoting is excellent in case of intranet application because of the speed.

Web Services provide an open-protocol-based exchange of information. Web Services are best when you need to communicate with an external organization or another (non-.NET) technology applications.

What is the proxy of the server object in .NET Remoting?

Proxy is copy of the server object( a thin layer) that resides on the client side and behaves as if it was the server. It delegate calls to the real server object. This process is also known as marshalling.

What do mean by remotable objects in .NET Remoting?

Remotable objects can be marshalled across the application domains. You can marshal by value, where a deep copy of the object is created and then passed to the receiver. You can also marshal by reference, where just a reference to an existing object is passed.

What are channels in .NET Remoting?

Channels represent the objects that transfer the other serialized objects from one application domain in the same computer or to different computers. A channel must exist before an object can be transferred.

Windows Communication Foundation :Interview Questions with Answers

What is WCF?
Windows Communication Foundation (WCF) is an SDK for developing and deploying services on Windows. WCF provides a runtime environment for services, enabling you to expose CLR types as services, and to consume other services as CLR types.

WCF is part of .NET 3.0 and requires .NET 2.0, so it can only run on systems that support it. WCF is Microsoft's unified programming model for building service-oriented applications with managed code. It extends the .NET Framework to enable developers to build secure and reliable transacted Web services that integrate across platforms and interoperate with existing investments.

Windows Communication Foundation combines and extends the capabilities of existing Microsoft distributed systems technologies, including Enterprise Services, System. Messaging, Microsoft .NET Remoting, ASMX, and WSE to deliver a unified development experience across multiple axes, including distance (cross-process, cross-machine, cross-subnet, cross-intranet, cross-Internet), topologies (farms, fire-walled, content-routed, dynamic), hosts (ASP.NET, EXE, Windows Presentation Foundation, Windows Forms, NT Service, COM+), protocols (TCP, HTTP, cross-process, custom), and security models (SAML, Kerberos, X509, username/password, custom).

What is service and client in perspective of data communication?
A service is a unit of functionality exposed to the world. The client of a service is merely the party consuming the service.

What is endpoint in WCF? or What is three major points in WCF?
Every service must have Address that defines where the service resides, Contract that defines what the service does and a Binding that defines how to communicate with the service.

In WCF the relationship between Address, Contract and Binding is called Endpoint. The Endpoint is the fusion of Address, Contract and Binding.


1. Address : Specifies the location of the service which will be like http://Myserver/MyService.Clients will use this location to communicate with our service.

2. Contract : Specifies the interface between client and the server. It's a simple interface with some attribute.

3. Binding : Specifies how the two parties will communicate in term of transport and encoding and protocols.

What is binding and how many types of bindings are there in WCF?
A binding defines how an endpoint communicates to the world. A binding defines the transport (such as HTTP or TCP) and the encoding being used (such as text or binary).

A binding can contain binding elements that specify details like the security mechanisms used to secure messages, or the message pattern used by an endpoint.

WCF supports nine types of bindings.

1. Basic binding :
Offered by the BasicHttpBinding class, this is designed to expose a WCF service as a legacy ASMX web service, so that old clients can work with new services. When used by the client, this binding enables new WCF clients to work with old ASMX services.


2. TCP binding :
Offered by the NetTcpBinding class, this uses TCP for cross-machine communication on the intranet. It supports a variety of features, including reliability, transactions, and security, and is optimized for WCF-to-WCF communication. As a result, it requires both the client and the service to use WCF.

3. Peer network binding :
Offered by the NetPeerTcpBinding class, this uses peer networking as a transport. The peer network-enabled client and services all subscribe to the same grid and broadcast messages to it.

4. IPC binding :
Offered by the NetNamedPipeBinding class, this uses named pipes as a transport for same-machine communication. It is the most secure binding since it cannot accept calls from outside the machine and it supports a variety of features similar to the TCP binding.

5. Web Service (WS) binding :
Offered by the WSHttpBinding class, this uses HTTP or HTTPS for transport, and is designed to offer a variety of features such as reliability, transactions, and security over the Internet.

6. Federated WS binding :
Offered by the WSFederationHttpBinding class, this is a specialization of the WS binding, offering support for federated security.

7. Duplex WS binding :
Offered by the WSDualHttpBinding class, this is similar to the WS binding except it also supports bidirectional communication from the service to the client.

8. MSMQ binding :
Offered by the NetMsmqBinding class, this uses MSMQ for transport and is designed to offer support for disconnected queued calls.

9. MSMQ integration binding :
Offered by the MsmqIntegrationBinding class, this converts WCF messages to and from MSMQ messages, and is designed to interoperate with legacy MSMQ clients.

What is contracts in WCF?
In WCF, all services expose contracts. The contract is a platform-neutral and standard way of describing what the service does.

WCF defines four types of contracts.

1. Service contracts : Describe which operations the client can perform on the service.

2. Data contracts : Define which data types are passed to and from the service. WCF defines implicit contracts for built-in types such as int and string, but we can easily define explicit opt-in data contracts for custom types.

3. Fault contracts : Define which errors are raised by the service, and how the service handles and propagates errors to its clients.

4. Message contracts : Allow the service to interact directly with messages. Message contracts can be typed or untyped, and are useful in interoperability cases and when there is an existing message format we have to comply with.


What is address in WCF and how many types of transport schemas are there in WCF?
Address is a way of letting client know that where a service is located. In WCF, every service is associated with a unique address. This contains the location of the service and transport schemas. WCF supports following transport schemas

1. HTTP
2. TCP
3. Peer network
4. IPC (Inter-Process Communication over named pipes)
5. MSMQ

The sample address for above transport schema may look like

http://localhost:81
http://localhost:81/MyService
net.tcp://localhost:82/MyService
net.pipe://localhost/MyPipeService
net.msmq://localhost/private/MyMsMqService
net.msmq://localhost/MyMsMqService

What is the difference WCF and Web services?
1. Web services can only be invoked by HTTP. While Service or a WCF component can be invoked by any protocol and any transport type.

2. Second web services are not flexible. But Services are flexible. If you make a new version of the service then you need to just expose a new end point. So services are agile and which is a very practical approach looking at the current business trends.

How can we host a service on two different protocols on a single server?
Let’s first understand what this question actually means. Let’s say we have made a service and we want to host this service using HTTP as well as TCP.

You must be wondering why to ever host services on two different types of protocol. When we host a service it’s consumed by multiple types of client and it’s very much possible that they have there own protocol of communication. A good service has the capability to downgrade or upgrade its protocol according the client who is consuming him.

Let’s do a small sample in which we will host the ServiceGetCost on TCP and HTTP protocol.

Once we are done the server side coding its time to see make a client by which we can switch between the protocols and see the results. Below is the code snippet of the client side for multi-protocol hosting

How does WCF work?
Follows the 'software as a service' model, where all units of functionality are defined as services.

A WCF Service is a program that exposes a collection of Endpoints. Each Endpoint is a portal (connection) for communication with either clients (applications) or other services.

Enables greater design flexibility and extensibility of distributed systems architectures.

A WCF application is represented as a collection of services with multiple entry points for communications.

What are the main components of WCF?

1.Service: The working logic or offering, implemented using any .Net Language(C).

2.Host: The environment where the service is parked. E.g. exe, process, windows service

3.Endpoints: The way a service is exposed to outside world.

Explain transactions in WCF.
Transactions in WCF allow several components to concurrently participate in an operation. Transactions are a group of operations that are atomic, consistent, isolated and durable. WCF has features that allow distributed transactions. Application config file can be used for setting transaction timeouts.

What are different isolation levels provided in WCF?
The different isolation levels:

1. READ UNCOMMITTED: - An uncommitted transaction can be read. This transaction can be rolled back later.

2. READ COMMITTED :- Will not read data of a transaction that has not been committed yet

3. REPEATABLE READ: - Locks placed on all data and another transaction cannot read.

4. SERIALIZABLE:- Does not allow other transactions to insert or update data until the transaction is complete.

Explain transactions in WCF.
Transactions in WCF allow several components to concurrently participate in an operation. Transactions are a group of operations that are atomic, consistent, isolated and durable. WCF has features that allow distributed transactions. Application config file can be used for setting transaction timeouts.

How do I serialize entities using WCF?
LINQ to SQL supports serialization as XML via WCF by generating WCF serialization attributes and special serialization specific logic during code-generation. You can turn on this feature in the designer by setting serialization mode to ‘Unidirectional’. Note this is not a general solution for serialization as unidirectional mode may be insufficient for many use cases.

What is End point ?
Every service must have Address that defines where the service resides, Contract that defines what the service does and a Binding that defines how to communicate with the service. In WCF the relationship between Address, Contract and Binding is called Endpoint.

The Endpoint is the fusion of Address, Contract and Binding.

Thursday, October 20, 2011

Story : Perfectness

A man and his girlfriend were married. It was a large celebration. All of their friends and family came to see the lovely ceremony and to partake of the festivities and celebrations. A wonderful time was had by all.

The bride was gorgeous in her white wedding gown and the groom was very dashing in his black tuxedo. Everyone could tell that! The love they had for each other was true.

A few months later, the wife comes to the husband with a proposal: “I read in a magazine, a while ago, about how we can strengthen our marriage.” She offered.

“Each of us will write a list of the things that we find a bit annoying with the other person. Then, we can talk about how we can fix them together and make our lives happier together.”

The husband agreed, so each of them went to a separate room in the house and thought of the things that annoyed them about the other. They thought about this question for the rest of the day and wrote down what they came up with.

The next morning, at the breakfast table, they decided that they would go over their lists.

“I’ll start,” offered the husband. He took out his list. It had many items on it enough to fill three pages, in fact. As he started reading the list of the little annoyances, he noticed that tears were starting to appear in his wife’s eyes.

“What’s wrong?” he asked. “Nothing” the wife replied, “keep reading your lists.”

The husband continued to read until he had read all three pages to his wife. He neatly placed his list on the table and folded his hands over top of it.

“Now, you read your list and then we’ll talk about the things on both of our lists.” He said happily.

Quietly the wife stated, “I don’t have anything on my list. I think that you are perfect, the way that you are. I don’t want you to change anything for me. You are lovely and wonderful and I wouldn’t want to try and change anything about you.”

The husband, touched by her honesty and the depth of her love and acceptance for him, turned his head and wept.

In life, there are enough times when we are disappointed, depressed and annoyed. We don’t really have to go looking for them. We have a wonderful world that is full of beauty, light and promise.

Why waste time in this world looking for the bad, disappointing or annoying when we can look around us, and see the wondrous things before us?

Lessons to learn from this: I believe that WE ARE HAPPIEST when we see and praise the good and try our best to forget the bad. Nobody’s perfect but we can find perfectness in them to change the way we see them.

Thursday, June 2, 2011

Ways To help The Environment


"Ways to Help the Environment: It Begins with One Individual Taking Action"

Most of us think that any action we take to contribute in protecting our home won’t do much since it will be just come from a single person. This makes us think that even if we try all ways to help the environment there are millions of people—a massively larger portion of the entire earth’s population—doing exactly the opposite. In this kind of mindset, where it is more apparent than any belief that something happens when a petty contribution is done, it is very difficult to see that a ripple effect will happen at the end of the day.


It’s easy to produce a long list of ways to help the environment, but it will still be difficult to believe that there’s something we can do to create a big impact to the environment. The problem lies when we see that a single contribution won’t create a significant change to save the environment. We have to understand that this isn’t a problem that a single person should solve alone. A huge environmental change will only happen if you can influence others to hold the same goals. On a scenario where others have gained the same motivations, a single person who started it all will no longer be alone.


The best first step in creating an impetus on ways to help the environment is to motivate others. It starts by disregarding the fact that a small contribution will not work. An individual must see that the contribution he is making is not being measure on the quantity of reduction in population he has made. That single action does more than that. By being a model, an individual makes other accomplish the same things. It is impossible to inspire all, but the point is, the contribution is not on a materialistic perspective. The contribution has a secondary effect in creating mindset for others to do the same thing.


Make others see that by doing some little ways to help the environment they too would be able to give, at least, little for the environment even if they don’t realize that these little actions create social activism to initiate the ripple effect in protecting the environment.

For more information you must visit below mentioned site : 
http://waystohelptheenvironment.org

Friday, March 25, 2011

Top 5 Social Networking Sites in India


         With Facebook challenging the web dominance of internet giant Google, its quite certain that Social Networking sites are not just a source of break or mere modes of connecting with friends and family. They have become a complete package providing communication, connection, networking, entertainment, information and much more. India is a huge market place for social networking sites with a large population contributing to sites like Facebook and Twitter.

Indian social networking space was dominated by Google owned Orkut for a very long time. The home players such as Ibibo has been trying hard to strengthen itself and take on to the global players. Lets have a look at which of these sites are really selling in India. Here is a list of top 5 social netwoking sites in India according to Alexa.
Facebook
The reigning king of Social Networking is the fourth most visited site in India after Google.co.in, Google.com, Yahoo.com. Though Facebook remains most popular in US with about 29.3 percent contribution, India is the third largest contributor to the site accounting 4.6%of site traffic.

Orkut
This Google owned social networking site got very popular in Brazil and India. Though the site didn’t receive the same popularity in rest of the world, it remained the number one social networking site in India for a very long time. The site went through a lot of changes and incorporated a lot of features to fight Facebook but finally lost the battle and went down to position two.
Twitter
The micro-blogging site has been one of the most talked about social networking site in the recent time. From becoming the word of the year to the first revenue from Google partnership, Twitter was in headlines all of 2009. Twitter started receiving a lot of attention in India with lot of Indian celebrities from Hollywood and Politics joined this bandwagon. Needless to say it was one of the easiest way celebs connected with their fans and the newest way of being in limelight. India is the second highest Twitter using nation accounting for 8 percent of the site traffic.
LinkedIn
LinkedIn was one of the most innovative networking space for professionals. It took social networking to another level by making it solely for professional networking. From posting jobs, marketing products to finding candidates, LinkedIn proved to be total hit among professionals from all arena. LinkedIn is the thirteenth most visited site in India.
Ibibo
India’s very own social networking site offers all that social networking sites offer. Connecting with friends, sharing photos, chat etc. Among other regular features, Ibibo also has social gaming quite similar to Facebook. Ibibo has recently launched games thats are quite similar to the famous Facebook games. Well, one of them has a very similar name as well. I’ll let you guess the name.

Sunday, March 20, 2011

Is Google greater than God?



    Today, I was going through a news article where "Google" was compared to "God". Seeing an attractive title, when I went through it, I came across many interesting facts which I thought of sharing with you all. It is difficult for 81 million web-browsing Indians even to imagine a life without Google.

Indians, like billions of other web users around the world, are so addicted to Google that it is actually difficult for them to replace the search engine giant in their online expeditions. If John Lennon, who unleashed an uproar by saying, “Beatles are more popular than Jesus”, was alive today, he would have sung ‘Google is Greater than God’. But for the godless Chinese, Google is just a search engine.

Thursday, March 10, 2011

What is the meaning of Social Networking in the cyber world?

     Social Networking is a way to communicate with each other and share own exp. or assumptions or whatever  a person thinking right now. In other words, we can say that ....
   Social networking is the grouping of individuals into specific groups, like small rural communities or a neighborhood subdivision, if you will. Although social networking is possible in person, especially in the workplace, universities, and high schools, it is most popular online. This is because unlike most high schools, colleges, or workplaces, the internet is filled with millions of individuals who are looking to meet other people, to gather and share first-hand information and experiences about cooking, sports, gardening, photos, video, developing friendships or professional alliances, finding employment, business-to-business marketing and even groups sharing information they like to share online.  


     When it comes to online social networking, websites are commonly used. These websites are known as social sites. Social networking websites function like an online community of internet users. Depending on the website in question, many of these online community members share common interests in hobbies, religion,  politics or other things they like to share. Once you are granted access to a social networking website you can begin to socialize. This socialization may include reading the profile pages of other members and possibly even contacting them. 
    The friends that you can make are just one of the many benefits to social networking online. Another one of those benefits includes diversity because the internet gives individuals from all around the world access to social networking sites. This means that although you are any where in the world and have internet facilities, you could develop an online friendship with someone. Not only will you make new friends, but also you just might learn about new cultures or new languages and you know that learning is always a good thing.
    As mentioned, social networking often involves grouping specific individuals or organizations together. While there are a number of social networking websites that focus on particular interests, there are others that do not. The websites without a main focus are often referred to as "traditional" social networking websites and usually have open memberships. This means that anyone can become a member, no matter what their hobbies, beliefs, or views are. However, once you are inside this online community, you can begin to create your own network of friends and eliminate members that do not share common interests or goals.
     As I'm sure you're aware, there are dangers associated with social networking including data theft and viruses, which are on the rise. Although danger does exist with networking online, as well as, it also exists in the real world, too. So, you are advised to proceed with caution online.
    By being aware of your cyber-surroundings and who you are talking to, you should be able to safely enjoy social networking online. It will take many phone conversations to get to know someone, but you really won't be able to make a clear judgment until you can meet each other in person.  Just use common sense and listen to your inner voice; it will tell you when something doesn't feel right about the online conversations taking place.


    Once you are well informed and comfortable with your findings, you can begin your search from hundreds of networking communities to join. This can easily be done by performing a standard internet search. Your search will likely return a number of results, including  Twitter, LinkedIn, MySpace, FriendWise, FriendFinder, Yahoo! 360, Facebook, Orkut etc. 

Wednesday, February 16, 2011

Vaccines: Protect your children from infectious diseases.

About Vaccines:
Vaccines work by teaching your immune system to recognize and remember bacteria or viruses. When you get a vaccine, your body makes a memory of the ingredients (also known as antigens). If in the future you are exposed to the actual disease, your immune system can then fight and kill the bacteria or viruses much more quickly. Vaccines are made by manipulating germs or parts of germs. Scientists decide which vaccine type will be the best based on the disease-causing agent and the natural behavior/course of the disease.
The main types of vaccines are:
  • Live, attenuated vaccines
  • Inactivated vaccines
  • Subunit vaccines
  • Conjugate vaccines
  • Toxoid vaccines
Two additional types of vaccines currently being researched are:
  • DNA vaccines
  • Recombinant vector vaccines

Live, attenuated

The whole germ is attenuated (weakened) so that it cannot cause disease, but can cause an immune response. Since these types of vaccines are most similar to the actual disease, they are more effective and often only require one or two doses for lifetime immunity. There is a remote chance that the weakened germ can revert back to its full strength and cause disease. Live attenuated vaccines should not be given to individuals with weakened or damaged immune systems. To maintain potency, live attenuated vaccines require refrigeration and protection from light.
Examples include Measles, Mumps Rubella (MMR) and Influenza Vaccine Live, Intranasal (FluMist®)

Inactivated

The whole germ is killed using heat or chemicals. The immune system response is not as strong as with live attenuated vaccines, therefore several doses and boosters may be required to achieve immunity. An inactivated vaccine cannot cause disease and is generally safe for those with weakened or damaged immune systems.
Examples include influenza inactivated vaccine (injectable)

Subunit

Only the portions of the germ that cause an immune response are used to create subunit vaccines. These portions of the germ are called antigens. Subunit vaccines can contain from 1 to 20 antigens. Since only the specific, necessary parts of the germ are used for this type of vaccine, the adverse events risk is lower.
Examples include the Hepatitis B vaccine.
Scientists can use the following methods to identify and then obtain the antigens:
  • Grow the germ and break it apart to harvest the necessary antigens.
  • Create antigen molecules using DNA technology.

Conjugate

Similar to subunit vaccines, conjugate vaccines use only portions of the germ. Many bacteria molecules are coated by a sugar called polysaccharide. This coating hides or disguises the germ (antigens) so that the immature immune systems of infants are not able to recognize it. Therefore, scientists attach the polysaccharide to a stronger protein. When the immune system responds to the protein, it also responds to the polysaccharide.
Examples include Haemophilus Influenza Conjugate Vaccine (Hib) and Pneumoccocal Conjugate Vaccine (Prevnar®)

Toxoid

The toxins secreted by bacteria are inactivated to make toxoid vaccines. This technique is reserved for diseases in which the secreted toxins are the main cause of the illness. Scientists inactivate the toxin by using a diluted chemical solution called formalin. The resulting inactivated toxin or toxoid is harmless.
Examples include tetanus and diphtheria vaccines.

DNA vaccines

Scientists hope to extract a portion of the germ's DNA and make copies of it to create a DNA vaccine. This type of vaccine would hopefully produce better protection like a live virus vaccine but with even less likelihood of producing disease; it would not contain the actual disease causing part of the germ and therefore cannot cause the disease. There are currently studies of DNA vaccines for herpes and influenza.

Recombinant vector vaccines

These vaccines are similar to DNA vaccines except the weakened or attenuated germ is used to carry DNA to the cells to stimulate immunity. Similar to live, attenuated vaccines, recombinant vector vaccines are similar to the actual disease. Currently, scientists are working on HIV, rabies and measles vaccines using this technology.

Monday, February 14, 2011

What is difference between Reapeater, Datalist and Gridview data control?


In ASP .NET basically there are three kinds of the Data Presentation Controls.

GridView (or DataGrid)
DataList
Repeater

When we talk about usage of one Data Presentation Controls
then many of us get confused about choosing one.  When you
need to use one of the data Presentation Control then You
have to see what kind of behavior you need in your Data
Display.

Do you want to show Data in many Pages or in one page?
Do you have to Display more then  one column in a Row ?
Do you want to have a Row repeating  Possibility?
Will users be able to update, Insert and delete the Data?

We are going provide a list of different abilities of
Repeater Control,  Datalist Control and GridView Control.

Features of a GridView
•Displays data as a table
•Control over
 –Alternate item
 –Header
 –Footer
 –Colors, font, borders, etc.
 –Paging
•Updateable
•Item as row

Features of Repeater
•List format
•No default output
•More control
•More complexity
•Item as row
•Not updateable


Features of DataList
•Directional rendering
•Good for columns
•Item as cell
•Alternate item
•Updateable

Thursday, February 10, 2011

If you can imagine it!



“   Before you speak, listen.
   Before you write, think.
    Before you spend, earn.
              Before you invest, investigate.
       Before you criticize, wait.
       Before you pray, forgive.
Before you quit, try.
    Before you retire, save.
  Before you die, give.”

Tuesday, February 8, 2011

Friday, January 28, 2011

C sharp : To print dynamic pyramid.

Now , You can play with pyramids and many different shapes from below mentioned programmed :-


Program(1): To print 1 * 10 Counting Table.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace pyramid
{
    class Program
    {
        static void Main(string[] args)
        {           
            int k, l;
            for (k = 1; k < 11; k++)
            {
                for (l = 1; l < 11; l++)
                {
                    Console.Write("  |  ");
                    Console.Write(k * l);
                }
                Console.WriteLine("\n");
            }
            }
    }
}



Program(2): To print pyramid as you like.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace pyramid
{
    class Program
    {
        static void Main(string[] args)
        {           



            {
                Console.WriteLine("Enter the value ");
                int k = int.Parse(Console.ReadLine());
                int n = k - 1;
                int x = 2 * (k - 1) + 1;
                for (int p = 0; p <= n; p++)
                {
                    for (int j = k - 1; j >= 0; j--)
                    {
                        Console.Write(" ");
                    }
                    for (int i = 0; i <= (x - 2 * (k - 1)); i++)
                    {
                        if (i % 2 == 1)
                        {
                            Console.Write("*");
                        }
                        else
                        {
                            Console.Write(" ");
                        }
                    }
                    Console.WriteLine();
                    k--;
                }
                Console.ReadLine();
            }
           }
    }
}


Program(3): To print Tower of Hanoui....

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace pyramid
{
    class Program
    {
        static void Main(string[] args)
        {           

            try
            {
                Console.Write("Enter the for Tower of Hanaui: ");
                int n = Convert.ToInt32(Console.ReadLine());
                for (int i = 1; i <= n; i++)
                {
                    for (int j = n; j >= i; j--)
                    {
                        Console.Write(" ");
                    }
                    for (int k = 1; k <= i; k++)
                    {
                        Console.Write("*");
                    }
                    for (int m = 2; m <= i; m++)
                    {
                        Console.Write("*");
                    }
                    Console.WriteLine();
                    for (int a = 1; a <= n; a++)
                    {
                        for (int j = n; j >= i; j--)
                        {
                            Console.Write(" ");
                        }
                        for (int k = 1; k <= i; k++)
                        {
                            Console.Write("*");
                        }
                        for (int m = 2; m <= i; m++)
                        {
                            Console.Write("*");
                        }
                        Console.WriteLine();
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }           
       }
    }




Start Program(4): To print Zigzag Tower

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace pyramid
{
    class Program
    {
        static void Main(string[] args)
        {    

            try
            {
                Console.Write("Enter number for Zigzag Tower: ");
                int n = Convert.ToInt32(Console.ReadLine());
                for (int i = 1; i <= n; i++)
                {
                    for (int j = n; j >= i; j--)
                    {
                        Console.Write(" ");
                    }
                    for (int k = 1; k <= i; k++)
                    {
                        Console.Write("*");
                    }
                    for (int m = 2; m <= i; m++)
                    {
                        Console.Write("*");
                    }
                    Console.WriteLine();
                    for (int a = 1; a <= n; a++)
                    {
                        for (int b = n; b >= a; b--)
                        {
                            Console.Write(" ");
                        }
                        for (int k = 1; k <= i; k++)
                        {
                            Console.Write("*");
                        }
                        for (int m = 2; m <= i; m++)
                        {
                            Console.Write("*");
                        }
                        Console.WriteLine();
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }           
      }
   }
}



Program(5): To print Nexted Pyramid...

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace pyramid
{
    class Program
    {
        static void Main(string[] args)
        {    

            try
            {
                Console.Write("Enter number for nexted pyramid: ");
                int n = Convert.ToInt32(Console.ReadLine());
                for (int i = 1; i <= n; i++)
                {
                    for (int j = n; j >= i; j--)
                    {
                        Console.Write(" ");
                    }
                    for (int k = 1; k <= i; k++)
                    {
                        Console.Write("*");
                    }
                    for (int m = 2; m <= i; m++)
                    {
                        Console.Write("*");
                    }
                    Console.WriteLine();
                    for (int a = 1; a <= n; a++)
                    {
                        for (int b = n; b >= a; b--)
                        {
                            Console.Write(" ");
                        }
                        for (int c = 1; c <= a; c++)
                        {
                            Console.Write("*");
                        }
                        for (int d = 2; d <= a; d++)
                        {
                            Console.Write("*");
                        }
                        Console.WriteLine();
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }           
       }
   }
}



Program(6): To print two simultaneouly Pyramid...

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace pyramid
{
    class Program
    {
        static void Main(string[] args)
        {    

            try
            {
                Console.Write("Enter number for simultaneously pyramid: ");
                int n = Convert.ToInt32(Console.ReadLine());
                for (int i = 1; i <= n; i++)
                {
                    for (int j = n; j >= i; j--)
                    {
                        Console.Write(" ");
                    }
                    for (int k = 1; k <= i; k++)
                    {
                        Console.Write("*");
                    }
                    for (int m = 2; m <= i; m++)
                    {
                        Console.Write("*");
                    }
                    Console.WriteLine();
                }
                {
                    for (int a = 1; a <= n; a++)
                    {
                        for (int b = n; b >= a; b--)
                        {
                            Console.Write(" ");
                        }
                        for (int c = 1; c <= a; c++)
                        {
                            Console.Write("*");
                        }
                        for (int d = 2; d <= a; d++)
                        {
                            Console.Write("*");
                        }
                        Console.WriteLine();
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }           
       }
    }
}


  I hope you enjoy and learn lots of programming concepts; basically looping concepts. You can contact us through this blog or email me at: ksantosh.mca@gmail.com
Thanks, Happy programming.. 


S. K. Singh