Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Friday, June 24, 2011

Abstract Class in c#.net

Abstract Class:
Now we will discuss about abstract class in c#.net.
·         Abstract class is class we cannot create object. We only use inherit
·         We are only use base class. If u r use abstract method u must implement derived class
Abstract Class Declaration
abstract class devenvexe
{
}
A abstract class can contain  abstract method or non-abstract method .abstract method not have implementation in abstract class .but same its have derived class
Abstract Method/Non Abstract Method:
abstract class devenvexe
{ 
public abstract void abstractMethod();
public void NonAbstractMethod()
    {
        Console.WriteLine("NonAbstract Method");
    }

}
Rules:
·         Abstract class not have sealed class
·         Abstract class only contain abstract method
·         Abstract class cannot be private
·         Abstract method cant have virtual keyword.because its  explicit virtuval method
·         Abstract class cannot be static
Performance
In our testing, abstract classes with virtual methods have better performance than interface implementation .

Reserve word in C#.net


Keywords in C#.net
C#.net have  77 Reserve word. You are  not declare variable/method in reserve words .if you want to declare reserved word you can use " @ "  symbol.
Example:
private void btn_Click(object sender, EventArgs e)
        {
            string string="Welocme to DevEnvExe"
        }
Suppose if you want use above coding
private void btn_Click(object sender, EventArgs e)
        {
            string @string="Welocme to DevEnvExe"
        }
Below list are C#.net reserve words
unchecked
unsafe
ushort
boolirtual
class
abstract
as
base
byte
char
decimal
int
sbyte
uint
ulong
break
case
catch
finally
checked
const
continue
default
delegate
do
double
else
enum
event
explicit
extern
false
fixed
float
for
foreach
goto
if
implicit
in
interface
internal
is
lock
long
namespace
new
null
object
operator
out
override
params
private
protected
public
readonly
ref
return
sealed
short
sizeof
stackalloc
static
string
struct
switch
while
this
throw
true
try
typeof
using
void
volatile


Monday, June 20, 2011

How many web.config files for sngle application?

How many web.config files for sngle application?

You should have only one web.config. 
but in sub folder you can have one web.cofing to set configuration of that folders.

 Example
 if your application have 4 folder then 5 web.config have in your application

Configuration File Dotnet

What is Web.Config File?

It is an optional XML File which stores configuration details for a specific asp.net web application. 



What is Machine.config File?

The Machine.Config file, which specifies the settings that are global to a particular machine. This file is located at the following path:

 

\WINNT\Microsoft.NET\Framework\[Framework Version]\CONFIG\machine.config

 

   As web.config file is used to configure one asp .net web application, same way Machine.config file is used to configure the application according to a particular machine. That is, configuration done in machine.config file is affected on any application that runs on a particular machine. Usually, this file is not altered and only web.config is used which configuring applications.

 

You can override settings in the Machine.Config file for all the applications in a particular Web site by placing a Web.Config file in the root directory of the Web site as follows:

\InetPub\wwwroot\Web.Config

Macine Config VS WebConfiguration

Difference between Machine.Config and Web.Config
Machine.Config:
i)  This is automatically installed when you install Visual Studio. Net.
ii) This is also called machine level configuration file.
iii)Only one machine.config file exists on a server.
iv) This file is at the highest level in the configuration hierarchy.

Web.Config:
i)  This is automatically created when you create an ASP.Net web application project.
ii) This is also called application level configuration file.
iii)This file inherits setting from the machine.config

Monday, June 13, 2011

Collection -2D Array

2 D Array
You want to use a 2D array containing any type(int,string ,etc) of value in your C# program
2D array contain 2 pair of values
Performance  PERF
2D Array  are slower to index elements than 1D arrays. They are sometimes more memory
2D Array String
String[,] os=new string[,]{
{"dev","Svalue"},
{"devenvexe","JValue"}
};
2D Array Int:
int[,] os=new int[,]{  {1,2}, {3,4} };
Get the Upperbound to Loop:
        

 string[,] ad = new string[,]
       {
           {"dev", "devenvexe"},
           {"TCS", "Tata"},
           {"CTS", "Cogn"},
          
       };

            // Get the upper bound to loop.
            //Upper bound means specify the dimention (0 or 1)
            for (int i = 0; i <= ad.GetUpperBound(0); i++)
            {
                string FDim = ad[i, 0]; // JS, TCS, CTS...
                string SDim = ad[i, 1]; // J Suqare, Tata, Cogn...

                MessageBox.Show(FDim);
                MessageBox.Show(SDim);
            }
If you want use Length keyword .it will return 6 so
string[,] ad = new string[,]
       {
           {"dev", "devenvexe"},
           {"TCS", "Tata"},
           {"CTS", "Cogn"},
          
       };

            // Get the upper bound to loop.
            //Upper bound means specify the dimention (0 or 1)
            for (int i = 0; i <= ad.Length/2; i++)
            {
                string FDim = ad[i, 0]; // JS, TCS, CTS...
                string SDim = ad[i, 1]; // J Suqare, Tata, Cogn...

                MessageBox.Show(FDim);
                MessageBox.Show(SDim);
            }
GetUpperBound VS Length:
Its faster to use Array Length
Looping Speed:
GetUpperBound: 142 ms
Length/2     : 47 ms

Wednesday, June 8, 2011

Collection - Array

Array
Arrays are references that point to fixed sizes of memory that you can store different kinds of elements in, such as values or references to other objects. In these examples, we look at simple examples of arrays.

·       Arrays is fixed number of memory allocate in system
·       It is initialize and with accessing with Square brackets []
·       Two dimensional array use comma with in bracket
How to create Array:   
 Int[] value=new int[Length]
// Int means data type suppose if you want string,bool,etc…
// value  is data type
// length means ,you can enter int value
Ex:
String val=new String[3];
Ex Program:
Using system;
Class Progra
{
//Public void button Click
Sting val=new String[3];
Val[0]="devenvexe";
Val[1]="Suthahar";
Val[2]="Suresh";
Foreach(string n in Val)
{
MesageBox.Show(n.Tostring);
}
}