Archive

Archive for the ‘Tutorial for Beginners’ Category

Constant arrays | Create constant arrays in C#

January 8th, 2012 No comments

Fun behind the constants array, is you can’t create it, because you can apply constant only a local values.  However there is certain work around. Instead of constant array you can declare read only array, but all depends upon the requirement that you have.

In my case I wanted to declare a static array those values should not be reassigned, I can achieve this with the help of static read only array
private static readonly string[]constArray ={  "val1", "val2", "val3"};

Here my array will be initialized first before use.  But it is not advisable.

>> Click here to Read the complete Article

Use of Non Abstract Method of Abstract Class in C#

January 8th, 2012 No comments

You can have non abstract method in abstract class; as such I didn’t find any use of these methods. Yes this is an option. May be it is useful in some situations when you want to call those methods inside your abstract methods.

As per abstraction rules, you cannot create the object of abstract class, means you cannot use the "new" keyword.

You can create any class as an abstract class with the help of “Abstract” keyword; even you can create any method as an abstract method inside the class. Abstract class can have both type of method “Abstract” & “Non Abstract”. You can inherit these classes inside the non abstract classes.
Abstract classes cannot have the implementations details of abstract methods.

>> Click here to Read the complete Article

DataGrid In CSharp

November 30th, 2011 No comments
If you are new to ADO.Net please visit our Ado.net section:

This is very flexible and popular control in Asp.net. We can use this tool to display data in Web/Windows environment.  It helps developers to develop a data driven application in .Net. It allows relationship; we can create relationship on the fly. We can update, delete our data at runtime.  Datagrid has some essential features like Sorting & Pagination. Sorting enables user to sort any columns and paginations helps grid in faster loading of data. User can navigate from one page to another. You can set the size of per page(How many records you want to display in one go).

>> Click here to Read the complete Article

Collection Initializers in C# 3.0 | Basic Tutorial

November 15th, 2011 No comments
Collection Initializers is a new concept introduced in C# 3.0.  By implementing this concept in your code you can save your time for initializing individual property of your class.  In C# 2.0 you can initialize a collection you can use the following syntax.

>> Click here to Read the complete Article

How to Access and create XML Web Services in C Sharp

November 15th, 2011 No comments

Web service is very important, we can create web services using .Net either C# or VB.net or any .Net supported languages. Web Services are platform independent and can be used remotely.  If your OS supports to HTTP protocols then web services can be consumed by any program so they are platform independent we can say.  To understand the web service you must have at least basic knowledge of C Sharp or any programming language and Ado.net.

 
In .Net framework we can create two types of Web service
  1. Xml Web services: which are used by normal programs and
  2. Web Services of Remoting.

>> Click here to Read the complete Article

C# 3.0 Automatic properties

October 18th, 2011 No comments

Automatic Property:
It’s a new feature in Asp.net. It was introduced with asp.net 3.5.  Prior to 3.5 it was mandatory to declare private variable of a property to hold the value. For example if you  have one property with the name of “YourName” in your class then prior to declare this property you have to have declare one private variable of the same data type which will hold the property value. See the below code

>> Click here to Read the complete Article

Multithreading in C Sharp – Basics

October 18th, 2011 No comments

Multithreading is made up with the conjunctions of two words Multi + threading = Multithreading.

Multithreading enables the multitasking & multiprocessing. It means you can run many program asynchronously or concurrently. Let me explain the meaning of threading because I am sure you all are aware of the English meaning of the word “Multi”. So thread is defined the execution path of your program. In terms of computer science thread is a smallest unit of processing.  You can divide a complex task into small sub task those are known as threads for example, OS manage different threads.

For example you can write something on word, simultaneously you can give instructions to print, and the same time you can chat with your friends. These all are possible by threads, you can write multiple threads to execute different actions in you program. In Multithreading helps to execute different process at the same time, it saves lots of time and increase the performance also. As we knows in .Net threads are running inside the App domain. Each app domain started a single thread but you can create other threads from the single threads.

In C#(.Net) you can use “using System.Threading” namespace to enable the multithreading. It contains important features such as

>> Click here to Read the complete Article

C# events and event handlers

October 18th, 2011 No comments

What are Events in C#: In simple terms event means happening or action or occurrence of anything. Event can be anything it can be mouse click, enter key press, lost focus. In other words they are the notification, means something is going to change or ready to happen. Handling of the event is known as response. for example when you click on a button another page opens, here button click is an event and second part is the response of that events.  When events happens a notification sent to client so that client can prepare the response.

 

>> Click here to Read the complete Article

Dataset in C#

October 11th, 2011 No comments

Must Read: ADO.net Tutorial for beginners

It is the main core feature of ado.net. Ado.net has two main components as Dataset and Data Provider. It persists data in memory which is separately from the database. By nature it is disconnected. You can perform all DML statement. You can load data in dataset from any data source like SQL Server, Oracle etc. You can create table inside the Dataset even you can define the keys and create relationship between them.  It belongs to “System.Data” namespace.

How to Declare Dataset in C#

>> Click here to Read the complete Article

ADO.net Tutorial for beginners

October 7th, 2011 No comments

Ado.net:  Ado.net is the new technology and used to connect with different datasource. It provides interoperability and scalable data access by XML. So we can say if any application who can read the XML can process data. It is the new invention of Microsoft to fulfill the today’s application development requirement. Now days web applications are not tightly coupled, they have become loosely coupled web application model. All web applications are xml based.  Ado.net provide disconnected model along with tight integration with XML, Ado.net is based on Microsoft Active X Object (ADO).  It supports n Tier applications with the help of DataSet. Ado.net is based on XML. Means it uses xml for everything for example data encoding and data access.  Here everything is handle at the client side which increate the performance.

It is integral part of .Net Framework.  You can connect with your data source using Ado.net.  ADO.net has two main components as

>> Click here to Read the complete Article