C# ASP.NET ADO.NET JAVASCRIPT JQUERY AJAX SILVERLIGHT WPF
C# OOPS HTML&CSS DHTML ASP.NET ADO.NET JAVASCRIPT JQUERY AJAX SILVERLIGHT MVVM WPF SQL SERVER Photoshop Dreamweaver Flash Illustrator
Blog Archive
-
2012
(83)
- September(2)
-
August(81)
- Important WPF Classes and Namespaces
- Applications of WPF
- Programming With WPF
- Limitations of Silverlight and flash
- Silverlight Feature comparison with Flash Features
- How to Add XML File in Your Silverlight Project
- 3 Pixel Shader Effects in Silverlight
- Rotate Image in 3D direction using Silverlight
- First Application of Silverlight
- Silverlight 2.0
- How Install Ajax?
- Ajax Advantage
- JavaScript Loops
- Show a Military Clock and ordinary clock
- How To validate a Form in ASP. Net
- How to show Day of Week
- How to Swap a Image using JavaScript
- Special Character in JavaScript
- Prompt Box in JavaScript
- The use of data adapter.?
- The steps involved to fill a dataset?
- Dataset object in ADO .NET
- Handling Connection Events
- The SQLCONNECTION OBJECT
- Command Constructors
- The SQLCOMMAND OBJECT
- Gridview in ASP.NET
- Introduction Of Master Page
- Server Side State Management
- Query String In ASP.NET
- Cookies in ASP.NET
- State Management in ASP.NET
- Various types of application that we can develop i...
- Properties
- Inheritance ,Polymorphism
- Array,Indexer and Collections
- Control Statements
- Operators, types and variables in C#
- Fundamental of C#
- C# & other Programming Languages
- The WPF Designer
- C# DataTypes
- What is Ajax?
- Silverlight 1.0
- Confirm Box in JavaScript
- Component classes
- Life Cycle of ASP.NET
- The Basics of JQuery
- Jquery Blog Content
- Birth Of WPF
- .Net Frameworks Architecture
- History Of Ajax
- Why Silverlight?
- How to access a URL of parent page in ASP. net
- THE ADO.NET Architecture?
- Architecture of ASP.NET
- Introduction Of Ajax
- Ajax Blog Content
- Introduction of SilverLight
- Silverlight Blog Content
- Introduction to Javascript Blog
- Javascript Blog Content
- Introduction to Ado.Net blog
- Ado.Net Blog Content
- Introduction to C# Blog
- C# Blog Content
- Introduction to Asp.Net
- Asp.Net Blog Content
- Introduction to WPF
- WPF Blog Content
- WPF Interview Question
- Silverlight Interview Question
- Ajax Interview Question
- JQuery Interview Question
- Javascript Interview Question
- DHTML Interview Question
- Ado.Net Inetview Questions
- SQL Interview Questions
- HTML&CSS Interview Questions
- Asp.Net Interview Qusetions
- C# Interview Questions
Control Statements
The if Statement
if statement is used to take different paths of logic, depending on the conditions.
|
The switch Statement
Another form of selection statement is the switch statement, which executes a
set of logic depending on the value of a given parameter. The types of the
values a switch statement operates on can be booleans, enums, integral types,
and strings.
using System;
class SwitchTest
{
public static void Main()
{
Console.WriteLine("milk bottel size: 1=Small 2=Medium 3=Large");
Console.Write("Please enter your selection: ");
string s = Console.ReadLine();
int n = int.Parse(s);
int price = 0;
switch(n)
{
case 1:
price += 25;
break;
case 2:
price += 25;
goto case 1;
case 3:
price += 50;
goto case 1;
default:
Console.WriteLine("Invalid selection. Please select 1, 2, or 3.");
break;
}
if (price != 0)
Console.WriteLine("Please insert {0} cents.", price);
Console.WriteLine("Thank you for your business.");
}
}
|
The while Loop
While loop is used to check a condition and then continues to execute a block of code as long as the condition evaluates to a boolean value of true. Syntax:-
while (<boolean expression>)
{
<statements>
}
When the boolean expression evaluates to false, the while loop statements are
skipped and execution begins after the closing brace of that block of code.
using System;
class whiletest
{
static void Main()
{
//
// Continue in while loop until index is equal to ten.
//
int i = 0;
while (i < 10)
{
Console.Write("While statement ");
//
// Write the index to the screen.
//
Console.WriteLine(i);
//
// Iterate the variable.
//
i++;
}
}
}
|
The do Loop
A do loop is similar to the while loop, except that it checks
its condition at the end of the loop. This means that the do loop is guaranteed
to execute at least one time.
using System;
class DoWhileLoopDemo
{
public static void Main()
{
int i = 0; // Initialize counter variable
do
{
if ((i % 2) == 0)
{
Console.WriteLine(i);
}
i++; //Increment the counter
}
while (i <= Limit); // Condition check
}
}
|
The for Loop
It works like a while loop, except that the syntax of the for loop includes initialization and condition modification. for loops are appropriate when you know exactly how many times you want to perform the statements within the loop. The contents within the for loop parentheses hold three sections separated by semicolons (<initializer list>; <boolean expression>; <iterator list>) { <statements> }.
using System;
class ForLoop
{
public static void Main()
{
for (int i=0; i < 20; i++)
{
if (i == 10)
break;
if (i % 2 == 0)
continue;
Console.Write("{0} ", i);
}
Console.WriteLine();
}
}
|
Foreach Statement:
The foreach statement is
new to the C family of languages; it is used for looping through the elements of
an array or a collection.
class ForEachTest
{
static void Main(string[] args)
{
int[] num = new int[] { 0, 1, 2, 3, 4, 5, 6,7,8 };
foreach (int i in num)
{
System.Console.WriteLine(i);
}
}
}
|









