<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-16121640</id><updated>2011-12-15T08:39:40.272+05:30</updated><title type='text'>Developer's Guide</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://top-techies.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16121640/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://top-techies.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Abhinav</name><uri>http://www.blogger.com/profile/13786912810543719639</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>6</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-16121640.post-113782198146371309</id><published>2006-01-21T11:03:00.000+05:30</published><updated>2006-01-21T11:09:41.743+05:30</updated><title type='text'>Top-Techies(C# Interview Questions)</title><content type='html'>&lt;ol start="1" type="1"&gt; &lt;li class="MsoNormal" style=""&gt;&lt;b style="color: rgb(0, 153, 0);"&gt;What’s the implicit name      of the parameter that gets passed into the class’ set method?&lt;/b&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Value,      and its datatype depends on whatever variable we’re changing.&lt;/span&gt; &lt;a name="more55"&gt;&lt;/a&gt;&lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;How do you inherit from a      class in C#?&lt;/span&gt; &lt;/b&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;Place a colon and then the name of the base class. Notice      that it’s double colon in C++.&lt;/span&gt; &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b style="color: rgb(0, 153, 0);"&gt;Does C# support multiple      inheritance? &lt;/b&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;No, use interfaces instead.&lt;/span&gt; &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;When you inherit a      protected class-level variable, who is it available to?&lt;/span&gt; &lt;/b&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;Classes in the      same namespace&lt;/span&gt;. &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;Are private class-level      variables inherited?&lt;/span&gt; &lt;/b&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;Yes, but they are not accessible, so looking at      it you can honestly say that they are not inherited. But they are.&lt;/span&gt; &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b style="color: rgb(0, 153, 0);"&gt;Describe the accessibility      modifier protected internal. &lt;/b&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;It’s available to derived classes and      classes within the same Assembly (and naturally from the base class it’s      declared in).&lt;/span&gt; &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;C# provides a default      constructor for me. I write a constructor that takes a string as a      parameter, but want to keep the no parameter one. How many constructors      should I write?&lt;/span&gt; &lt;/b&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;Two. Once you write at least one constructor, C#      cancels the freebie constructor, and now you have to write one yourself,      even if there’s no implementation in it.&lt;/span&gt; &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;What’s the top .NET class      that everything is derived from?&lt;/span&gt; &lt;/b&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;System.Object.&lt;/span&gt; &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;How’s method overriding      different from overloading?&lt;/span&gt; &lt;/b&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;When overriding, you change the method      behavior for a derived class. Overloading simply involves having a method      with the same name within the class.&lt;/span&gt; &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;What does the keyword      virtual mean in the method definition?&lt;/span&gt; &lt;/b&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;The method can be over-ridden.&lt;/span&gt; &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;Can you declare the      override method static while the original method is non-static?&lt;/span&gt; &lt;/b&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;No,      you can’t, the signature of the virtual method must remain the same, only      the keyword virtual is changed to keyword override.&lt;/span&gt; &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;Can you override private      virtual methods?&lt;/span&gt; &lt;/b&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;No, moreover, you cannot access private methods in      inherited classes, have to be protected in the base class to allow any      sort of access.&lt;/span&gt; &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b style="color: rgb(0, 153, 0);"&gt;Can you prevent your class      from being inherited and becoming a base class for some other classes?&lt;/b&gt;      &lt;span style="color: rgb(255, 0, 0);"&gt;Yes, that’s what keyword sealed in the class definition is for. The      developer trying to derive from your class will get a message: cannot      inherit from Sealed class WhateverBaseClassName. It’s the same concept as      final class in Java.&lt;/span&gt; &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;Can you allow class to be      inherited, but prevent the method from being over-ridden?&lt;/span&gt; &lt;/b&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;Yes, just      leave the class public and make the method sealed.&lt;/span&gt; &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;What’s an abstract class?&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt; &lt;/span&gt;&lt;/b&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;A      class that cannot be instantiated. A concept in C++ known as pure virtual      method. A class that must be inherited and have the methods over-ridden.      Essentially, it’s a blueprint for a class without any implementation.&lt;/span&gt; &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;When do you absolutely      have to declare a class as abstract (as opposed to free-willed educated      choice or decision based on UML diagram)?&lt;/span&gt; &lt;/b&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;When at least one of the      methods in the class is abstract. When the class itself is inherited from      an abstract class, but not all base abstract methods have been      over-ridden.&lt;/span&gt; &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;What’s an interface class?&lt;/span&gt;      &lt;/b&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;It’s an abstract class with public abstract methods all of which must      be implemented in the inherited classes.&lt;/span&gt; &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;Why can’t you specify the      accessibility modifier for methods inside the interface?&lt;/span&gt; &lt;/b&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;They all must      be public. Therefore, to prevent you from getting the false impression      that you have any freedom of choice, you are not allowed to specify any      accessibility, it’s public by default.&lt;/span&gt; &lt;/li&gt; &lt;/ol&gt; &lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16121640-113782198146371309?l=top-techies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://top-techies.blogspot.com/feeds/113782198146371309/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16121640&amp;postID=113782198146371309' title='19 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16121640/posts/default/113782198146371309'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16121640/posts/default/113782198146371309'/><link rel='alternate' type='text/html' href='http://top-techies.blogspot.com/2006/01/top-techiesc-interview-questions.html' title='Top-Techies(C# Interview Questions)'/><author><name>Abhinav</name><uri>http://www.blogger.com/profile/13786912810543719639</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>19</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16121640.post-113389799663915376</id><published>2005-12-07T01:08:00.000+05:30</published><updated>2005-12-07T01:10:00.243+05:30</updated><title type='text'>C# Self Tutor (Chapter 4)</title><content type='html'>&lt;div align="left"&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="color:#6666cc;"&gt;NAMESPACES AND USING STATEMENTS:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="color:#6666cc;"&gt;&lt;/span&gt;&lt;div align="left"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#6666cc;"&gt;Definition:&lt;/span&gt; &lt;/div&gt;&lt;div align="left"&gt;&lt;span style="color:#cc66cc;"&gt;namespace:&lt;br /&gt;&lt;/span&gt;Namespace can be defined as the logical collection of classes and their related functions. Using directive is used to facilitate the use of namespaces. A single C# file can declare several namespaces. The namespaces are implicitly public. The system namespace is the root namespace for fundamental types in the .NET framework. The system namespace also contains many second-level namespaces. Within a namespace one can declare another namespace, class, interface, struct, enum, and delegate.&lt;br /&gt;USING DIRECTIVE:&lt;br /&gt;Using directives enable the use of namespace and types defined in the namespaces. The types within the namespace can be referred by the fully qualified name.&lt;br /&gt;&lt;em&gt;&lt;span style="color:#33cc00;"&gt;Using system&lt;br /&gt;Namespace n1&lt;br /&gt;{&lt;br /&gt;Public class ebony1&lt;br /&gt;{&lt;br /&gt;Public static void main ()&lt;br /&gt;{&lt;br /&gt;N2.ebony2.diaplay ();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;Namespace n2&lt;br /&gt;{&lt;br /&gt;Public class ebony2&lt;br /&gt;{&lt;br /&gt;Public static void display ()&lt;br /&gt;{console.writeline ("sky is not ur limit; u have to go beyond sky.");&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;Output:&lt;br /&gt;sky is not ur limit; u have to go beyond sky&lt;/span&gt;&lt;/em&gt;.&lt;br /&gt;The n2 namespace has the class ebony2. The display function of n2 namespace has been invoked from namespace n1 by declaration n2.ebony2.diaplay ().&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="color:#cc66cc;"&gt;NAMESPACE ALIAS:&lt;br /&gt;&lt;/span&gt;&lt;/em&gt;Namespace alias declaration enables a user-defined symbol to represent a namespace. Then one can be able to represent the namespace name.&lt;br /&gt;&lt;em&gt;&lt;span style="color:#33cc00;"&gt;Using system;&lt;br /&gt;Using np=n1.n2.ebony2;&lt;br /&gt;Namespace n1&lt;br /&gt;{&lt;br /&gt;Public class ebony1&lt;br /&gt;{&lt;br /&gt;Public static void main ()&lt;br /&gt;{&lt;br /&gt;Np.display ();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;Namespace n2&lt;br /&gt;{&lt;br /&gt;Public class ebony2&lt;br /&gt;{&lt;br /&gt;Public static void display ()&lt;br /&gt;{&lt;br /&gt;Console.writeline ("sky is not ur limit; u have to go beyond sky");&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;Output:&lt;br /&gt;sky is not ur limit; u have to go beyond sky&lt;br /&gt;&lt;/span&gt;&lt;/em&gt;The output of this program is same as the output of the previous program. In this program the namespace alias is defined as np for n1.n2.ebony2.&lt;/div&gt;&lt;div align="left"&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="color:#cc66cc;"&gt;NAMESPACE HIERARCHY:&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;In C# one can organize the classes using namespaces. The following example demonstrates the organization of classes.&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;&lt;em&gt;Using system;&lt;br /&gt;Namespace n1&lt;br /&gt;{&lt;br /&gt;Class ebony1&lt;br /&gt;{&lt;br /&gt;Public static void main ()&lt;br /&gt;{console.write ("how r u?");&lt;br /&gt;Show s1=new show();&lt;br /&gt;S1.display ();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;Class show&lt;br /&gt;{public void display ()&lt;br /&gt;{&lt;br /&gt;Console.write ("fine");&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;Output:&lt;br /&gt;How r u? fine&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;Here the hello class belongs to the namespace n1. But the class show is not having any enclosing namespace and it is considered to be a member of the global namespace.&lt;br /&gt;There are many pre-defined namespace like system.IO (contains classes related to input and output), system.reflection (provides the methods to describe the classes used in a program), system.data (contains the classes that constitute ADO.Net architecture), system.threading (contains classes related to threading), sytem.xml (contains classes related to XML).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16121640-113389799663915376?l=top-techies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://top-techies.blogspot.com/feeds/113389799663915376/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16121640&amp;postID=113389799663915376' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16121640/posts/default/113389799663915376'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16121640/posts/default/113389799663915376'/><link rel='alternate' type='text/html' href='http://top-techies.blogspot.com/2005/12/c-self-tutor-chapter-4.html' title='C# Self Tutor (Chapter 4)'/><author><name>Abhinav</name><uri>http://www.blogger.com/profile/13786912810543719639</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16121640.post-113298401519225343</id><published>2005-11-26T10:55:00.000+05:30</published><updated>2005-11-26T11:16:55.600+05:30</updated><title type='text'>C# Self Tutor (chapter 3)</title><content type='html'>&lt;p align="left"&gt;&lt;br /&gt;                                                                       &lt;span style="font-size:180%;color:#3366ff;"&gt;C# STATEMENTS&lt;/span&gt;&lt;/p&gt;&lt;p align="left"&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="font-size:130%;color:#ff99ff;"&gt;BLOCKS:&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&lt;p align="left"&gt;The blocks are set by left hand brace ({ ) and right hand brace ( }). It allows multiple lines to act singularly. Blocks are used to specify the boundaries in different language elements like classes, structures and interfaces.&lt;br /&gt;&lt;/p&gt;&lt;p align="left"&gt;&lt;span style="font-size:130%;color:#ff99ff;"&gt;LABELS and GOTO:&lt;/span&gt;&lt;br /&gt;Labels are used as identifiers within a program. The control can jump to any location within a program by using the goto and label statement. A label is any valid identifier within colon ( : ).&lt;br /&gt;&lt;/p&gt;&lt;p align="left"&gt;&lt;span style="font-size:130%;color:#ff99ff;"&gt;CONST DECLARATION:&lt;/span&gt;&lt;br /&gt;Local constants can be declared using const keyword. Its scope is valid within the block declaring the variable.&lt;br /&gt;&lt;/p&gt;&lt;p align="left"&gt;&lt;span style="font-size:130%;color:#ff99ff;"&gt;IF STATEMENT:&lt;br /&gt;&lt;/span&gt;The if statement executes statement based on the value of a Boolean expression.&lt;br /&gt;&lt;/p&gt;&lt;p align="left"&gt;&lt;em&gt;&lt;span style="color:#33cc00;"&gt;Using class&lt;br /&gt;Class ebony&lt;br /&gt;{&lt;br /&gt;Public static void main (string [] args)&lt;br /&gt;{if (args.length==0)&lt;br /&gt;Console.writeline ("null string");&lt;br /&gt;Else if (args.length! =0)&lt;br /&gt;Console.writeline ("not a null string");&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;Output&lt;br /&gt;Null string&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&lt;em&gt;&lt;span style="color:#33cc00;"&gt;&lt;p align="left"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/em&gt;&lt;span style="font-size:130%;color:#ff99ff;"&gt;SWITCH STATEMENT:&lt;br /&gt;&lt;/span&gt;The switch statement is a control statement that handles multiple selections by passing control to one of the case statement within its body. The switch statement takes the form&lt;br /&gt;&lt;/p&gt;&lt;p align="left"&gt;&lt;em&gt;&lt;span style="color:#33cc00;"&gt;Switch (expression)]&lt;br /&gt;{&lt;br /&gt;Case constant-expression:&lt;br /&gt;Statement&lt;br /&gt;Jump statement&lt;br /&gt;[default: statement]&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&lt;p align="left"&gt;Where:&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;Expression&lt;/span&gt;: an integral or string type expression.&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;Statement&lt;/span&gt;: the embedded statements to be executed if control is transferred to the case of the default.&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;Jump-statement&lt;/span&gt;: a jump statement that transfers control out of the case body.&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;Constant-expression&lt;/span&gt;: control is transferred to a specific case according to the value of this expression.&lt;br /&gt;Control is transferred to the case statement whose constant-expression matches expression. The switch statement can include any number of case instances, but no two cases constant within the same switch statement can have the same value. Execution of the statement body begins at the selected statement and proceeds until the jump-expression control out of the case body.&lt;br /&gt;Unlike C++ switch statement, C# does not support an explicit fall thru from one case label to another. If expression does not match any constant-expression, control is transferred to the statement that follows the default label. If there is no default label, control is transferred outside the switch.&lt;br /&gt;&lt;/p&gt;&lt;p align="left"&gt;&lt;span style="font-size:130%;color:#ff99ff;"&gt;DO STATEMENT:&lt;/span&gt;&lt;br /&gt;The do statement executes a statement or a block of statements repeatedly until a specified expression evaluates to false. It takes the following form:&lt;/p&gt;&lt;p align="left"&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="color:#33cc00;"&gt;Do statement while (expression);&lt;br /&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&lt;p align="left"&gt;Where:&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;Expression&lt;/span&gt;: an expression that can be implicitly converted to bool or a type that contains overloading of the true and false operators. The expression is used to test the loop-termination criteria.&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;Statement&lt;/span&gt;: the embedded statements are executed.&lt;br /&gt;Unlike while statements, the body of loop of the "do" statement is executed at least once regardless of the value of the expression.&lt;br /&gt;&lt;/p&gt;&lt;p align="left"&gt;&lt;span style="color:#ff99ff;"&gt;FOR STATEMENT:&lt;/span&gt;&lt;br /&gt;The for loop executes a statement or a block of statements repeatedly until a specified expression evaluates to false; takes the following form:&lt;br /&gt;&lt;/p&gt;&lt;p align="left"&gt;&lt;span style="color:#33cc00;"&gt;&lt;em&gt;For ( [initializes]; [expression]; [iterations])&lt;br /&gt;Statements;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="left"&gt;Where:&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;Initializes&lt;/span&gt;: a comma separated list of expressions or assignment statements to initialize the loop counters.&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;Expression&lt;/span&gt;: an expression that can be implicitly converted to bool or a type that contains overloading of the true and false operators. The expression is used to test the loop termination criteria.&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;Iterations&lt;/span&gt;: expression statements to increment or decrement the loop counters.&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;Statement&lt;/span&gt;: the embedded statements to be executed.&lt;br /&gt;The &lt;span style="color:#33cc00;"&gt;FOR&lt;/span&gt; statement executes the statements repeatedly as follows:&lt;br /&gt;First, the initializes are evaluated&lt;br /&gt;Then, while the expression evaluates to true, the statements are executed and the iterators are evaluated.&lt;br /&gt;When the expression becomes false, control is transferred outside the loop.&lt;br /&gt;Because the test of expression takes place before the execution of the loop, a for statement executes zero or more.&lt;br /&gt;&lt;/p&gt;&lt;p align="left"&gt;&lt;span style="font-size:130%;color:#ff99ff;"&gt;FOREACH, IN STATEMENT:&lt;/span&gt;&lt;br /&gt;The foreach statement repeats a group of embedded statements for each element in an array or an object collection. The foreach statement is used to iterate thru the collection to get the desired information, but should not be used change the contents of the collection to avoid unpredictable side effects. The statements take the following form:&lt;/p&gt;&lt;p align="left"&gt;&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;&lt;em&gt;Foreach (type identifier in expression)&lt;br /&gt;Statement;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="color:#33cc00;"&gt;&lt;em&gt;&lt;p align="left"&gt;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;Where:&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;Type&lt;/span&gt;: the type pf the identifier&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;Identifier&lt;/span&gt;: the iteration variable that represents the collection element.&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;Expression&lt;/span&gt;: object collection or array expression. The type of the collection element must be convertible to the identifier type.&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;Statement&lt;/span&gt;: the embedded statements to be executed.&lt;br /&gt;The embedded statements continue to execute for each element in the array or collection. After the iteration has been completed for the all elements in the array or collection, control is transferred to the next statement following the foreach.&lt;br /&gt;When used with an array, the foreach statement repeats the embedded statements for each element in the array.&lt;/p&gt;&lt;p align="left"&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="color:#33cc00;"&gt;Example:&lt;br /&gt;Foreach (int i in array)&lt;br /&gt;{&lt;br /&gt;If (i%2==0) even++;&lt;br /&gt;}&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&lt;em&gt;&lt;span style="color:#33cc00;"&gt;&lt;p align="left"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/em&gt;&lt;span style="font-size:130%;color:#ff99ff;"&gt;WHILE STATEMENT&lt;/span&gt;:&lt;br /&gt;The first type of loop that java provides is called a while loop. A while loop checks to see if a condition is true and if so, executes a statement or set of statements. After executing those statements, the condition is again checked. Of it is still true, it executes the statements over again, continuing in the same fashion until the condition is finally false.&lt;br /&gt;The basic form of the while loop is:&lt;/p&gt;&lt;p align="left"&gt;&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;&lt;em&gt;While (expression) statement&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="color:#33cc00;"&gt;&lt;p align="left"&gt;&lt;br /&gt;&lt;/span&gt;Where:&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;Expression&lt;/span&gt;: an expression that can be implicitly converted to bool or a type that contains overloading of the true and false operators. The expression is used to test the loop termination criteria.&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;Statement&lt;/span&gt;: the embedded statements to be executed.&lt;br /&gt;Because the test expression takes place before execution of the loop, a while loop executes zero or more.&lt;br /&gt;A while loop can be terminated when a break, goto, return or throw statement transfers control outside the loop; pass control to the next iteration without exiting the loop, use the continue statement.&lt;/p&gt;&lt;p align="left"&gt;&lt;br /&gt;&lt;span style="font-size:130%;color:#ff99ff;"&gt;JUMP STATEMENTS:&lt;/span&gt;&lt;br /&gt;Branching is performed using jump statements, which cause an immediate transfer of the program control. The following keywords are used in jump statements:&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;Break&lt;br /&gt;Continue&lt;br /&gt;Default&lt;br /&gt;Goto&lt;br /&gt;Return&lt;/span&gt;&lt;/p&gt;&lt;span style="color:#ff0000;"&gt;&lt;p align="left"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#ff99ff;"&gt;Break statement&lt;/span&gt;&lt;br /&gt;The break statement terminates the closest enclosing loop or conditional statement in which it appears. Control is passed to the statement that follows the terminated statement, if any. The break statement takes the form:&lt;/p&gt;&lt;p align="left"&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="color:#33cc00;"&gt;Using system;&lt;br /&gt;Class ebony&lt;br /&gt;{&lt;br /&gt;Public static void main ()&lt;br /&gt;{&lt;br /&gt;For (int i=1; i&lt;=10; i++)&lt;br /&gt;{&lt;br /&gt;If (i==5)&lt;br /&gt;Break;&lt;br /&gt;Console.writeline (i);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;Output&lt;br /&gt;1&lt;br /&gt;2&lt;br /&gt;3&lt;br /&gt;4&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&lt;em&gt;&lt;span style="color:#33cc00;"&gt;&lt;p align="left"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/em&gt;&lt;span style="color:#ff99ff;"&gt;CONTINUE STATEMENT:&lt;/span&gt;&lt;br /&gt;The continue statement passes control to the next iteration of the enclosing iteration in&lt;br /&gt;Which it appears. It takes the form:&lt;/p&gt;&lt;p align="left"&gt;&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;&lt;em&gt;Using system;&lt;br /&gt;Class ebony&lt;br /&gt;{&lt;br /&gt;Public static void main ()&lt;br /&gt;{&lt;br /&gt;For (int i=1; i&lt;=5; i++)&lt;br /&gt;{&lt;br /&gt;If (i==4)&lt;br /&gt;Continue;&lt;br /&gt;Console.writeline (i);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;Output:&lt;br /&gt;1&lt;br /&gt;2&lt;br /&gt;3&lt;br /&gt;5&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="color:#33cc00;"&gt;&lt;em&gt;&lt;p align="left"&gt;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style="color:#ff99ff;"&gt;GOTO STATEMENT:&lt;/span&gt;&lt;br /&gt;The goto statement transfers the program control directly to a labeled statement. It takes one of the following forms:&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;Goto identifier;&lt;br /&gt;Goto case constant-expression;&lt;br /&gt;Goto default;&lt;/span&gt;&lt;/p&gt;&lt;span style="color:#ff0000;"&gt;&lt;p align="left"&gt;&lt;br /&gt;&lt;/span&gt;Where:&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;Identifier&lt;/span&gt;: a label.&lt;br /&gt;&lt;span style="color:#33cc00;"&gt;Constant-expression&lt;/span&gt;: a switch-case label&lt;br /&gt;In the first form, the identifier indicates a label located in the current body, the same lexical scope, or an enclosing scope of the goto statement.&lt;br /&gt;A common use of goto is to transfer control to a specific switch-case label; or the default label in a switch statement.&lt;br /&gt;The goto statement is also useful to get out of deeply nested loops.&lt;/p&gt;&lt;p align="left"&gt;&lt;br /&gt;&lt;span style="color:#ff99ff;"&gt;RETURN STATEMENTS:&lt;/span&gt;&lt;br /&gt;The return statement terminates execution of the method in which it appears and returns control to the calling. It can also return the value of the optional expression. If the method is of the type void, the return statement can be omitted. The return statement takes the form:&lt;/p&gt;&lt;p align="left"&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="color:#33cc00;"&gt;Return [expression];&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&lt;em&gt;&lt;span style="color:#33cc00;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;p align="left"&gt;&lt;br /&gt;Where: &lt;span style="color:#33cc00;"&gt;expression&lt;/span&gt;: the value returned by a method. The expression is not used with methods of the type void.&lt;/p&gt;&lt;p align="left"&gt;&lt;br /&gt;&lt;span style="color:#ff99ff;"&gt;THROW and CATCH STATEMENTS:&lt;/span&gt;&lt;br /&gt;The throw statement is used to throw an exception during the program execution. The throw exception is usually of type system.exception or a type of class derived from system.exception. The example below throws the new exception divide by zero.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="color:#33cc00;"&gt;Using system&lt;br /&gt;Class ebony&lt;br /&gt;{&lt;br /&gt;Public static void main ()&lt;br /&gt;{&lt;br /&gt;Values (3, 0);&lt;br /&gt;}&lt;br /&gt;Static int values (int a, int b)&lt;br /&gt;{&lt;br /&gt;if(b==0)&lt;br /&gt;throw new exception ("divide by zero");&lt;br /&gt;return a/b;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;Output:&lt;br /&gt;Unhandled exception: system.exception: divide by zero&lt;br /&gt;At test. values (int32 a, int32 b)&lt;br /&gt;At test. main ()&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&lt;em&gt;&lt;span style="color:#33cc00;"&gt;&lt;p align="left"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/em&gt;The word new indicates that we are creating an object. We are creating an object that looks like system.exception. "Throw" is a reserved word that means it is recognized by C #. Exception is a class in the system namespace. In other words we are identifying an exception, creating an object of it, and throwing it. Whenever you use "throw" keyword in your code, no lines of the code get called after that.&lt;br /&gt;Usually throw statement is used with try-catch statements. The try statements provide a mechanism for catching the exception that occur during the execution of the code of the block. The code to handle the exception is provided within the catch block. The code within the finally block is always executed when the control leaves the try statement.&lt;/p&gt;&lt;p align="left"&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="color:#33cc00;"&gt;Using system&lt;br /&gt;Class ebony&lt;br /&gt;{&lt;br /&gt;Public static void main ()&lt;br /&gt;{&lt;br /&gt;Try&lt;br /&gt;{int [] a={1,2,3,4,5};&lt;br /&gt;Console.writeline (a [36]);&lt;br /&gt;}&lt;br /&gt;Catch (IndexOutOfRangeException ff)&lt;br /&gt;{&lt;br /&gt;Console.writeline (f.message);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;Output:&lt;br /&gt;Index was outside the bounds of the array.&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;&lt;p align="left"&gt;&lt;em&gt;&lt;span style="color:#33cc00;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/em&gt;The message property of the exception is used to display the description of the execution. &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16121640-113298401519225343?l=top-techies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://top-techies.blogspot.com/feeds/113298401519225343/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16121640&amp;postID=113298401519225343' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16121640/posts/default/113298401519225343'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16121640/posts/default/113298401519225343'/><link rel='alternate' type='text/html' href='http://top-techies.blogspot.com/2005/11/c-self-tutor-chapter-3.html' title='C# Self Tutor (chapter 3)'/><author><name>Abhinav</name><uri>http://www.blogger.com/profile/13786912810543719639</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16121640.post-113120421400473257</id><published>2005-11-05T20:49:00.000+05:30</published><updated>2005-11-12T18:47:52.483+05:30</updated><title type='text'>C# Self Tutor (Chapter 2)</title><content type='html'>&lt;p class="MsoNormal"&gt;&lt;?xml:namespace prefix = o /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;u&gt;C# COMPILER AND EDITORS:&lt;o:p&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;.NET SDK Beta 1 release of Microsoft’s new platform, .NET, incorporated with C# command line compiler. You must have to install .NET SDK to run a C# program. Once you install .NET SDK you can write your C# program in any text editors including notepad, WordPad or visual studio.&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;u&gt;FIRST C# PROGRAM&lt;o:p&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;u&gt;&lt;o:p&gt;&lt;span style="TEXT-DECORATION: none"&gt;&lt;/span&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/p&gt;&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; PADDING-BOTTOM: 1pt; BORDER-LEFT: windowtext 1pt solid; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid"&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(255,0,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;/* welcome to the world of C# programming */&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(255,0,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;Class ebony&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(255,0,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;{&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(255,0,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;Static void main ()&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(255,0,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;{&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(255,0,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;System.console.writeline (“heavens”);&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(255,0,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;}&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;&lt;span style="COLOR: rgb(255,0,0)"&gt;}&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;/div&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;To compile the above program from the command line:&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in; TEXT-INDENT: -0.25in"&gt;Create the source file using any text editor such as notepad etc. save it using a name such as ebony.cs. C# source code files usually have the extension as .csTo invoke the compiler, enter the command&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in"&gt;&lt;b&gt;csc ebony.cs&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in; TEXT-INDENT: -0.25in"&gt;If your program does not contain any compilation errors, a ebony.exe file will be created.&lt;b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in; TEXT-INDENT: -0.25in"&gt;To run the program enter the command:&lt;b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-INDENT: 0.5in"&gt;&lt;b&gt;C:\csharp&gt;ebony&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in; TEXT-INDENT: -0.25in"&gt;output of the above program is:&lt;b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;&lt;b&gt;heavens&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;Alternative way of coding the above program is to define &lt;b&gt;&lt;i&gt;using&lt;/i&gt;&lt;/b&gt; directive at the top of the program as shown below:&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; PADDING-BOTTOM: 1pt; BORDER-LEFT: windowtext 1pt solid; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid"&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(255,153,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;/* welcome to the world of C# programming */&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(255,153,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;Using system;&lt;span style="font-size:+0;"&gt; &lt;/span&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;// using directives&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(255,153,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;Class ebony&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(255,153,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;{&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(255,153,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;Static void main ()&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(255,153,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;{&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(255,153,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;console.writeline (“heavens”);&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(255,153,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;}&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;&lt;span style="COLOR: rgb(255,153,0)"&gt;}&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;/div&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;The C# program must contain a main method, in which control starts and ends. The main method is where you create objects and execute other methods.&lt;/p&gt;&lt;p class="MsoNormal"&gt;The main method is a static method that resides inside a class or a struct.&lt;/p&gt;&lt;p class="MsoNormal"&gt;There are three methods to declare the main method:&lt;/p&gt;&lt;ul style="MARGIN-TOP: 0in" type="disc"&gt;&lt;li class="MsoNormal"&gt;it can return a void&lt;/li&gt;&lt;/ul&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;Static void main ()&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;{&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;…….&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;}&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;ul style="MARGIN-TOP: 0in" type="disc"&gt;&lt;li class="MsoNormal"&gt;it can also return an int&lt;/li&gt;&lt;/ul&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;Static int main ()&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;{&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;……….&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;return 0;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;}&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;ul style="MARGIN-TOP: 0in" type="disc"&gt;&lt;li class="MsoNormal"&gt;it can also take arguments&lt;/li&gt;&lt;/ul&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;static int&lt;span style="font-size:+0;"&gt; &lt;/span&gt;main(string[] args)&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;{&lt;br /&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;………..&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;return 0;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;}&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;C# programs generally use the input/output services provided by run-time library of the .NET Framework. The statement:&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-INDENT: 0.25in"&gt;&lt;b&gt;System.console.writeline (“heavens”);&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;Uses the &lt;b&gt;writeline &lt;/b&gt;method, one of the output methods of the c&lt;b&gt;onsole&lt;/b&gt; class in the runtime library. It displays its string parameter on the standard output stream followed by a new line. Other &lt;b&gt;console&lt;/b&gt; methods are used for different input and output operations.&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;&lt;u&gt;Another example:&lt;o:p&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/p&gt;&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; PADDING-BOTTOM: 1pt; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; COLOR: rgb(255,102,0); MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid"&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;Class ebony&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;{&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;Static void main ()&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;{&lt;br /&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;system.console.writeline (“100{0}, {1}”, 100,200);&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;}&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;}&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;&lt;u&gt;Output&lt;o:p&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;100 100, 200&lt;/p&gt;&lt;/div&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;Here the {0} is replaced with 100 and {1} is replaced with 200. the comma (,) separates the two numbers. Thus {0} means the first number and {1} means the second. C# likes to count from zero and not one.&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.25in"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;&lt;u&gt;Another example:&lt;o:p&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/p&gt;&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; PADDING-BOTTOM: 1pt; MARGIN-LEFT: 0.25in; BORDER-LEFT: windowtext 1pt solid; MARGIN-RIGHT: 0in; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid"&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(153,0,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;Class ebony&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(153,0,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;{&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(153,0,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;Static void main ()&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(153,0,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;{&lt;br /&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;int k,a;&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(153,0,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;k=09;&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(153,0,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;a=14;&lt;span style="font-size:+0;"&gt; &lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(153,0,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;system.console.writeline (“{0}{1}”, a,k);&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(153,0,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;}&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(153,0,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;}&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(153,0,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(153,0,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;&lt;u&gt;Output:&lt;o:p&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;&lt;span style="COLOR: rgb(153,0,0)"&gt;1409&lt;/span&gt;&lt;u&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/p&gt;&lt;/div&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 0.5in; TEXT-ALIGN: justify"&gt;&lt;b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;&lt;u&gt;COMPILING AND RUNNING C#:&lt;o:p&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;To compile the program, create a source file by using any text editor and save it with the extension .cs. &lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;For example if the name if the C# source code file is ebony.cs then the proper command would be &lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;&lt;b&gt;Csc ebony.cs&lt;span style="font-size:+0;"&gt; &lt;/span&gt;/t:exe /out:ebony.cs&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;As /&lt;b&gt;t:exe &lt;/b&gt;and &lt;b&gt;/out:ebony.cs &lt;/b&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;are the default compiler settings these can be left out, therefore the simplest command is:&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;&lt;b&gt;Csc ebony.cs&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;&lt;i&gt;/&lt;b&gt;target (Specifies the output file format)&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;/target:exe&lt;span style="font-size:+0;"&gt; &lt;/span&gt;creates an .exe file&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;/target:library&lt;span style="font-size:+0;"&gt; &lt;/span&gt;creates a code(.dll) file&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;/target:module&lt;span style="font-size:+0;"&gt; &lt;/span&gt;creates a module&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;/target:winexe&lt;span style="font-size:+0;"&gt; &lt;/span&gt;creates a window program that provides user interface from either &lt;span style="font-size:+0;"&gt;&lt;/span&gt;from either frame work library or with Win32 API’s&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1.5in; TEXT-INDENT: -1.5in; TEXT-ALIGN: justify"&gt;/main &lt;span style="font-size:+0;"&gt;&lt;/span&gt;compiler option lets you specify which class contains the Main method, in case your code has more than one class Main method&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1.5in; TEXT-INDENT: -1.5in; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1.5in; TEXT-INDENT: -1.5in; TEXT-ALIGN: justify"&gt;&lt;u&gt;TYPES&lt;o:p&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1.5in; TEXT-INDENT: -1.5in; TEXT-ALIGN: justify"&gt;C#.&lt;span style="font-size:+0;"&gt; &lt;/span&gt;supports two kinds of types &lt;b&gt;: value types &lt;/b&gt;and &lt;b&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;reference types&lt;/b&gt;.&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1.5in; TEXT-INDENT: -1.5in; TEXT-ALIGN: justify"&gt;Value types include simple types include simple types (eg char, int , float), enum &lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1.5in; TEXT-INDENT: -1.5in; TEXT-ALIGN: justify"&gt;types, and struct types.&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN-LEFT: 1.5in; TEXT-INDENT: -1.5in; TEXT-ALIGN: justify"&gt;Reference types include class types, interface types, delegate types and array types.&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;The variables of the value types directly contain their data, where as variable of the reference types store references to objects. The new operator is used when a reference is declared and then will immediately point to something.&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;C# provides two predefined reference-types object and string. All the other reference types tend to be class defined by the user. However all inherit from system.object. this system.object class has ToString() method, which simply returns a class name or value depending on what is being applied to.&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;There are predefined data types likes byte, short, int, long which represent 8-bit, 16-bit, 32-bit and 64 bit signed integer data type. Byte, ushort, unit, ulong represents 8-bit, 16-bit, 32bit and 64-bit unsigned integer data type respectively. Float and double type represents single and double precision floating data type. Decimal data represents 128 bit data type and can have 28 significant digits. The char represents character data types. The bool data type indicates true of false. The type bool is an alias for system.boolean.&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;&lt;u&gt;DATA TYPE CONVERSION:&lt;/u&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;C# supports two types of conversion. &lt;b&gt;Implicit &lt;/b&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;and &lt;b&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;explicit&lt;/b&gt; conversions.&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;Implicit conversions are direct conversion. For example:&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;int ival=34;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;long lval=intvalue;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;explicit conversions include type casting, conversion. For example:&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;long lval=1409&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;int ival=(int)lval;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;&lt;u&gt;CHECKED AND UNCHECKED OPERATOR:&lt;o:p&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;&lt;u&gt;&lt;o:p&gt;&lt;span style="TEXT-DECORATION: none"&gt;&lt;/span&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;The checked and unchecked operators are used to control the arithmetic overflow for integral-type arithmetic operations and conversions.&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; PADDING-BOTTOM: 1pt; BORDER-LEFT: windowtext 1pt solid; COLOR: rgb(204,0,0); PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid"&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;using system;&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;class ebony&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;{&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;Public static void main ()&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;{&lt;br /&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;int num=400; // 110010000&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;unchecked&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;{&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;Byte c= (byte) num; //overflow never detected&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;System.console.writeline (“the value of b :{ 0}”, c);&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;}&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;}&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;}&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;u&gt;Output&lt;/u&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;The value of b: 144&lt;/p&gt;&lt;/div&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;In an unchecked context, the result is truncated by discarding any high-order bits that do not fit in the destination type. The binary equivalent of 144 is 10010000. Because of this overflow exception is not thrown. If unchecked will be changed to check an unhandled exception will be thrown.&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;&lt;u&gt;VARIABLES AND PARAMETERS ref &amp; out&lt;o:p&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;A variable has a storage location and a specific type. This specific type defines what can be stored in that variable. A field is also a variable and is a usually associated with a lass or an object.&lt;/p&gt;&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; PADDING-BOTTOM: 1pt; BORDER-LEFT: windowtext 1pt solid; COLOR: rgb(255,204,102); PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid"&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;u&gt;Program A&lt;o:p&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;using system&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;class ebony&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;{&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;Public static void main ()&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;{&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;int a=3,b=a*4;&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;console.writeline (“a={0},b={1}”,a,b);&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;}&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;}&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;u&gt;Output&lt;o:p&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;A=3, b=12&lt;/p&gt;&lt;/div&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;The local variables a and b are declared and initialized with an initial value. Formal parameter declaration also defines variables. There are four kinds of parameters:&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;Value parameters, reference parameters, out parameters and parameter arrays.&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;A value parameter is usually initially before passing this variable as an argument into a method. Any change in the value of the parameter in the method has no effect in the corresponding variable, because the parameter is initialized by copying the value of the corresponding argument.&lt;/p&gt;&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; PADDING-BOTTOM: 1pt; BORDER-LEFT: windowtext 1pt solid; COLOR: rgb(204,153,51); PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid"&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;u&gt;Program B:&lt;o:p&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;using system;&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;class ebony&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;{&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;Static void display (int x)&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;{&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;x=x+20;&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;console.writeline (“the value inside method :{ 0}”, x);&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;}&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;Public static void main ()&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;{&lt;br /&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;int a=3,b=a*3;&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;Console.writeline (“before call of the method a={0},b={1}”,a,b);&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;Console.writeline (“after call of the method a={0},b={1}”a,b); &lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;}&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;}&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;u&gt;Output:&lt;o:p&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;before call of the method a=3, b=9&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;the value inside method: 23&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;after call of the method a=3, b=9&lt;/p&gt;&lt;/div&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;This example shows a method display that has a value parameter named x. the last line prints a=3 and b=9, even though the value parameter is modified.&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;A reference parameter is declared with the keyword ref. A reference parameter does not declare a new storage location. Any change in the reference parameter directly changes the corresponding argument.&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;The ref keyword is required both in the method declaration and the method invocation. The variable is initialized before used in the method as a reference parameter.&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;&lt;u&gt;NUMERIC FORMATTING:&lt;o:p&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;Numeric types can be formatted using the standard format characters. The console.writeline () use the format character to format the numeric type as specified. Different format characters and their description are as follows:&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;&lt;i&gt;Format character&lt;span style="font-size:+0;"&gt; &lt;/span&gt;description&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;C or c&lt;span style="font-size:+0;"&gt; &lt;/span&gt;currency format&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;D or d &lt;span style="font-size:+0;"&gt;&lt;/span&gt;decimal format&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;E or e&lt;span style="font-size:+0;"&gt; &lt;/span&gt;exponential format&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;F or f&lt;span style="font-size:+0;"&gt; &lt;/span&gt;fixed point format&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;G or g&lt;span style="font-size:+0;"&gt; &lt;/span&gt;general format&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;N or n&lt;span style="font-size:+0;"&gt; &lt;/span&gt;number format&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;P or p &lt;span style="font-size:+0;"&gt;&lt;/span&gt;percent format&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;R or r&lt;span style="font-size:+0;"&gt; &lt;/span&gt;round trip format&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;X or x&lt;span style="font-size:+0;"&gt; &lt;/span&gt;hexadecimal format&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;&lt;u&gt;STRING MANUPULATION:&lt;o:p&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;A string represents a series of characters. Once the instance of a string is created it cam not be changed. The string class provides various functions to manipulate a string and these functions generate a new string. Different functions are like copy, insert, join, concat, split, substring etc.&lt;/p&gt;&lt;div style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; PADDING-BOTTOM: 1pt; BORDER-LEFT: windowtext 1pt solid; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid"&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(204,102,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;Using system;&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(204,102,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;Using system.text;&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(204,102,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;Class ebony&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(204,102,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;{&lt;br /&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;public static void main()&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(204,102,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;{&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(204,102,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;Stringbuilder sb=new stringbuilder (“shoppers’”);&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(204,102,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;Sb=sb.append (“stop”);&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(204,102,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;Console.writeline (sb);&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(204,102,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;Sb.insert (5,” “);&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(204,102,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;Sb=sb.insert (8,” “);&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(204,102,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;Console.writeline (sb);&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(204,102,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;Console.writeline (sb.length);&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(204,102,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;Console.writeline (sb.append (“ “+”237/10-359/2”));&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(204,102,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;Console.writeline (sb.length);&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; COLOR: rgb(204,102,0); PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;}&lt;/p&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; TEXT-ALIGN: justify"&gt;&lt;span style="COLOR: rgb(204,102,0)"&gt;}&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;/div&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;The stringbuilder classes us used to represent a string which can be manipulated using different methods like append, insert and remove. The new string can still be references using the same instance. The new instance of the stringbuilder class sb is initially assigned using the constructor. The subsequently the instance of the stringbuilder is modified using the append method of the stringbuilder class. The length property can be used to get or set the length of the instance of the string.&lt;/p&gt;&lt;p class="MsoNormal" style="TEXT-ALIGN: justify"&gt;&lt;span style="font-size:+0;"&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16121640-113120421400473257?l=top-techies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://top-techies.blogspot.com/feeds/113120421400473257/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16121640&amp;postID=113120421400473257' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16121640/posts/default/113120421400473257'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16121640/posts/default/113120421400473257'/><link rel='alternate' type='text/html' href='http://top-techies.blogspot.com/2005/11/c-self-tutor-chapter-2.html' title='C# Self Tutor (Chapter 2)'/><author><name>Abhinav</name><uri>http://www.blogger.com/profile/13786912810543719639</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16121640.post-112993059896158983</id><published>2005-10-22T02:47:00.000+05:30</published><updated>2005-10-22T03:22:42.076+05:30</updated><title type='text'>C# Self Tutor (Chapter 1)</title><content type='html'>&lt;p&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;GETTING STARTED&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;C# is pronounced as “C sharp”. It is a new programming language that enables programmers in quickly building solutions for the Microsoft .NET platform&lt;br /&gt;C# is a java like programming language intended for writing enterprise applications. The C# is an evolution of C and C++. It uses many C++ features in the areas of statements, expressions and operators. C# introduces considerable improvement and innovations in areas such as type safety, versioning, events and garbage collection.&lt;br /&gt;We assume that we have no prior knowledge of any programming language. But before we get ensnared in the fascinating world of C#, let’s make a directory where we will save all our work. In order to do so, click on Start – Programs then go to Accessories and select Command Prompt in windows 2000 or the MS-DOS prompt as it is called in windows 98. Once at the command prompt create a directory called csharp (md csharp) and change to this directory (cd csharp). Now type the command ‘edit ebony.cs’, which will open the MS-DOS editor.&lt;br /&gt;&lt;br /&gt;C:\csharp&gt;edit ebony.cs&lt;br /&gt;Here .cs is used as the extension used for C# files.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;NEED FOR A NEW TECHNOLOGY:&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;Note that C# provides access to the common API styles: .NET, .COM, Automation and C-style API’s. it also supports unsafe mode, where you can use pointers to manipulate memory that is not under the control of the garbage collector.&lt;br /&gt;C# is an elegant, simple, type safe, object oriented language that allows enterprise programmers to build a breadth of applications. C# also gives you the capability to build durable system-level components by virtue of the following features:&lt;br /&gt;&gt;Full COM/Platform support for the existing code integration.&lt;br /&gt;&gt;Robustness thru garbage collection and type safety.&lt;br /&gt;&gt;Security provided thru intrinsic code trust mechanisms&lt;br /&gt;&gt;Full support of extensible metadata concepts.&lt;br /&gt;&lt;br /&gt;As the number of lines of code increases in a program it becomes very much difficult ton manage the program. The C++ programming language helps in managing the code by introducing the classes. The code maintainability has further been simplified by introducing software development with the help of COM (Component Object Model). The COM components can be developed by using different languages and tools provided by Microsoft. But developing a COM component was never an easy task. Hence there is always a demand for a language/platform which can help in developing components in a simpler way.&lt;br /&gt;When the number of application grows in a traditional windows operating system there are always chances of a dll (dynamic linked library) of one application may be overwritten by a dynamic linked library of another application or a new version of same application. Again different applications might use the same dll name. This results in crashes and even sometimes makes the operating system unstable.&lt;br /&gt;&lt;br /&gt;In order to tackle all these issues Microsoft has developed the .NET platform. This modern platform helps in fast development of good quality software which is easier to maintain. The applications developed under this platform are now can be distributed, in nature and can be accessed thru internet using standard in internet protocols. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;COMMON LANGUAGE RUNTIME (CLR)&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The common language runtime is the core of the .NET framework. It provides the runtime environment for running different programming languages supported by .NET. The CLR supports cross language interoperability by supporting intermediate language (IL) and Common Type System (CTS). The code running under CLR is known as Managed Code. CLR also supports automatic garbage collection. When an object is not referenced the garbage collector automatically removes the memory used by that object. Thus a programmer is free from the burden of releasing the memory in .NET&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;&lt;strong&gt;CLASS LIBRARY:&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;The .NET class library is a huge collection of classes. These classes are referred in a .NET programming language to achieve different functions. The .NET programming language cannot do anything without these classes. These classes are available in different groups like input/output, networking, security, diagnostics and runtime, data and XML classes. Web services and web form classes and windows forms classes.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;COMMON LANGUAGE SPECIFICATION:&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The language interoperability is one of the most important features of the .NET framework platform. In order to achieve this common language specification (CLS) is defined. The language features supported across different languages are included in CLS. The language construct supports by one language and not supported by the other language is not included in CLS. For example the unsafe code is supported in C#, but not supported in VB. Thus pointers are not CLS obedient.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;CHARACTERISTICS OF C#:&lt;/span&gt;&lt;/strong&gt; &lt;/p&gt;&lt;p&gt;The C# is a modern object oriented programming language which is derived from C and C++. The concepts C and C++ programming language are implemented in C# programming language in a simplified way. The key features of the C# programming language are: &lt;/p&gt;&lt;p&gt;&lt;br /&gt;1)&lt;span style="color:#ff0000;"&gt; Simple&lt;/span&gt;: C# achieves simplicity by eliminating the operators like à, :: which are used in C++. In C# all these operators are replaced by the dot (.) operators. In C++ the integers are sometimes used as Booleans. But in C# integers and Booleans are different data types. Bool type is an alias of the class System. Boolean and can have true and false values. In C# integers are never used for a true or false comparison. Such comparisons are done explicitly by comparing with zero or null.&lt;br /&gt;2) &lt;span style="color:#ff0000;"&gt;Consistent&lt;/span&gt;: all the types are considered as objects in C#. The namespace helps in referring the base classes and all these classes can be accessed by using namespace. Even one can use his own namespace. The namespace of one program can be accessed in another program using simpler mechanism.&lt;br /&gt;3)&lt;span style="color:#ff0000;"&gt;Modern&lt;/span&gt;: C# provided support for modern features like automatic garbage collection, rich error handling, decimal data type for financial and scientific calculations and modern delegate approaches. The automatic garbage collection helps in cleaning all the memory when memory is not referenced. C# has also throw, try …catch and try … finally blocks for handling errors and exceptions.&lt;br /&gt;4) &lt;span style="color:#ff0000;"&gt;Object oriented&lt;/span&gt;: C# is an object oriented programming language and supports encapsulation, inheritance and polymorphism. Encapsulation is achieved by exposing the functional details to the user and hiding the internal details. The encapsulation is achieved by the use of the modifier like public, private or protected on different members of a class. In C# the methods are not virtual by default. The methods can be redefined with the help of virtual and override keywords. The concepts of global function and constants are eliminated in C#.&lt;br /&gt;5) &lt;span style="color:#ff0000;"&gt;Type safety&lt;/span&gt;: In C# all the types are initialized tom their default values. The range of the arrays is always checked. The array in C# is an object. It is impossible to create an invalid cast in C#. All the memory referenced is cleared by automatic garbage collection.&lt;br /&gt;6) &lt;span style="color:#ff0000;"&gt;Version able&lt;/span&gt;: C# provides support for versioning by using the new and overrides keywords. In the derived class a method name can be declared same as the base class method and with the new modifier. A method in the base class can also be declared with the virtual keyword and can be overridden in the derived class by the applying the override modifier against the method.&lt;br /&gt;7) &lt;span style="color:#ff0000;"&gt;Compatible&lt;/span&gt;: one can invoke windows API and classic COM components in a C# program. C# also provides support for all the data types of standard COM component.&lt;br /&gt;8) &lt;span style="color:#ff0000;"&gt;Flexible&lt;/span&gt;: uses of pointers are not encouraged in C#. However one can use the pointers by declaring the class with unsafe keyword. However these methods will not be type safe and will work with the managed space. One can also pin down the objects so that the garbage collection will not relocate them and easy access can be achieved by the pointers.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;C# a C++ PERSPECTIVE:&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;C# is derived from C and C++. The C# has many syntax and concepts which are similar to C++.&lt;br /&gt;&gt;In C++ the main method can have integer return type. But in C# the Main method have void and integer return type.&lt;br /&gt;&gt;The members of a class in C# are defined inside the class definition. A member in C++ can be defined outside class definition.&lt;br /&gt;&gt;A class definition ends with a semicolon in C++. However in C# s semicolon is not used at the end of the class definition.&lt;br /&gt;&gt;All the classes in C# are derived from the super class object.&lt;br /&gt;&gt;In C# data types can be value types are reference types( class, interfaces, delegates)&lt;br /&gt;&gt;In C# all the variables are initialized with a default value. There are chances of un initialized variables in C++.&lt;br /&gt;&gt;C# supports string types and the string class provided lots of methods for easy manipulation of the strings.&lt;br /&gt;&gt;In C# the switch statement expression can be of a string type and does not allow automatic fall thru like C++.&lt;br /&gt;&gt;C# does not support multiple inheritances.&lt;br /&gt;&gt;All casting operations in C# are type safe.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;C# a JAVA PERSPECTIVE:&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;Java is the most popular language for developing web enabled applications.&lt;br /&gt;&gt;The java compiler generates the byte code and the Java Virtual Machine interprets the instructions. In C# the compiler produces Intermediate Language (IL) which then runs under the CLR. The Just in Time compiler then converts the IL code to native language.&lt;br /&gt;&gt;C# defines unsigned and signed data types. There are no unsigned data types in java.&lt;br /&gt;&gt;In C# all data types are considered as an object.&lt;br /&gt;&gt;C# uses the const keyword to declare constants. Java uses final keyword to declare constants.&lt;br /&gt;&gt;In C# it is possible that different class can have main method. During the compilation one can specify which main method will be used as entry point.&lt;br /&gt;&gt;In C# the namespace is used to refer to a group of classes. Java uses the packages keyword for similar purposes. In java the packages are linked with the directory structure.&lt;br /&gt;&gt;C# supports structure data type.&lt;br /&gt;&gt;Java handles all garbage collection automatically. In C# also garbage collection is automatic. However there is a provision to write destructors in C# programming language.&lt;br /&gt;&gt;Java uses inner class and interferences for handling events. C# uses delegates for event handling.&lt;br /&gt;&gt;C# uses “is” operator to check the type at runtime. Java has “instanceof” operator for the same.&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16121640-112993059896158983?l=top-techies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://top-techies.blogspot.com/feeds/112993059896158983/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16121640&amp;postID=112993059896158983' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16121640/posts/default/112993059896158983'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16121640/posts/default/112993059896158983'/><link rel='alternate' type='text/html' href='http://top-techies.blogspot.com/2005/10/c-self-tutor-chapter-1.html' title='C# Self Tutor (Chapter 1)'/><author><name>Abhinav</name><uri>http://www.blogger.com/profile/13786912810543719639</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-16121640.post-112819173442851328</id><published>2005-10-01T23:46:00.000+05:30</published><updated>2005-10-02T00:38:30.966+05:30</updated><title type='text'>The Power Of  'C++'</title><content type='html'>&lt;span style="color: rgb(255, 0, 0); font-weight: bold;font-size:130%;" &gt;The history: C++&lt;/span&gt;&lt;br /&gt;C++ language was originally a ‘pre-compiler’, similar to the processor of C, which converted special construction in its source code to pain C. This code was then compiled by a normal C compiler. The pre-code was read by the C++ pre compiler, was usually located in a file with the extension .cpp, .cc, or .c. This file would then be converted to a C source with the extension .c, which was complied and linked.&lt;br /&gt;C is supposed to be the root of C++. Dr. Bjarne Stroustrup at AT&amp;T’s BELL Labs in early 1980’s added object oriented features to C and a new language was made known as C++.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(204, 0, 0);font-size:130%;" &gt;Explaining C++ concepts:&lt;/span&gt;&lt;br /&gt;The C++ is a language that has used the art of compromise, a compromise between the roots of C language and implementing the Object Oriented programming approach.&lt;br /&gt;While object oriented programs can be written in languages such as C or BASIC, these languages lack certain features. For example, C provides no mechanism to hide variables from unauthorized access. C also does not allow one class to declare as a subclass of another. C++ symbol can be viewed as “Keep the features of C” and add (‘++’) new features to it.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(153, 0, 0);font-size:130%;" &gt;What is Object Oriented Programming?&lt;/span&gt;&lt;br /&gt;Object-oriented programming propagates a slightly different approach to programming problems than the strategy, which is usually used in C. The Object Oriented paradigm is the latest in the software development and the most adopted in the developing projects of today.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Procedural programming:&lt;/span&gt;&lt;br /&gt;The c-way is known as a ‘procedural approach’: a problem is decomposed into sub problems and this process is repeated until the subtasks can be coded. In procedural paradigm, the emphasis is on doing things.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(0, 0, 0);font-size:100%;" &gt;OOP Programming:&lt;/span&gt;&lt;br /&gt;In contrast to the procedural programming approach, OOP enables you to model more closely whatever real-world problem the program is written to solve. OOP treats data as an important and critical element in the program development. It ties data more closely to the functions that operates on it and thus avoids global access. It then builds data and functions around these objects. Thus, &lt;span style="font-style: italic;"&gt;an object is an identifiable entity with some characteristics and behavior&lt;/span&gt;.&lt;br /&gt;For instance if we take an example of Aston martin which is a class having characteristics like wheels, steering, brakes and their behavior is mobility. But Aston martin belongs to a class ‘car’. ‘Car’ itself is a subclass of another class ‘automobiles’.&lt;br /&gt;Hence, &lt;span style="font-style: italic;"&gt;we can say that a class is a group of objects that share common properties and relationships.&lt;/span&gt;&lt;br /&gt;For example we can say that ‘fish’ is the class but ‘dolphin’ is an object&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 102, 255);font-size:130%;" &gt;Organization of data and functions in OOP&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 153, 0);font-size:130%;" &gt;Some terminology and features:&lt;/span&gt;&lt;br /&gt;Data Abstraction&lt;br /&gt;Data Encapsulation&lt;br /&gt;Inheritance&lt;br /&gt;Polymorphism&lt;br /&gt;Dynamic Binding&lt;br /&gt;Message passing&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(204, 0, 0);font-size:130%;" &gt;DATA ABSTRACTION&lt;/span&gt;&lt;br /&gt;Abstraction is the process of simplifying the real world concept into its essential elements. &lt;span style="font-style: italic;"&gt;Abstraction refers to the act of representing essential features without including the background details or explanations&lt;/span&gt;. For example if we consider the example of keyboard. You only press certain key according to your requirement. What is happening inside, how is it happening etc. you needn’t know. This is abstraction; you only know the essential things to operate on keyboard without knowing the background details of keyboard.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);font-size:130%;" &gt;DATA ENCAPSULATION&lt;/span&gt;&lt;br /&gt;Data encapsulation is the way of combining both data and the functions that operate on that data under a single unit. &lt;span style="font-style: italic;"&gt;The wrapping up of data and functions (that operate on data) into a single unit (called class) is known as Encapsulation.&lt;/span&gt; Here the data is not accessible to outside world, and only those functions, which are wrapped in the class, can be access it. This insulation of data from direct access by the program is called data hiding or information hiding.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 153, 0);font-size:130%;" &gt;INHERITANCE&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Inheritance is the capability of one class of things to inherit capabilities or properties from another class.&lt;/span&gt; For instance, we are humans. We inherit from the class ‘humans’ certain properties such as ability to see, listen, and eat etc. but these properties are not unique to humans. The class ‘humans’ inherits these properties from the class ‘mammal’, which again inherit some characteristics from the class ‘animals’.&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold; color: rgb(102, 51, 102);"&gt;Role of inheritance in OOP&lt;/span&gt;&lt;br /&gt;Its capability to express the inheritance relationship, which makes it, ensures the closeness with the real world models.&lt;br /&gt;The idea of reusability is preserved. Inheritance allows addition of special features to an existing class.&lt;br /&gt;Inheritance bears a transitive nature. If a class A inherits properties from class B, then all subclasses of A will automatically inherit the properties of B.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(204, 0, 0);font-size:130%;" &gt;POLYMORPHISM&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Polymorphism is the ability for a message or data to be processed in more than one form. It is the property by which the same message can be sent to objects of several different classes, and each object can respond in a different way depending on its class.&lt;/span&gt; In OOP, this one thing, which may take several distinct forms, may be an operator or a function. This provides the facility of sending the same message to objects of parent class and objects of the class/subclass to which it belongs. This allows objects having different internal structures (of derived class) to share the same external interface.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);font-size:130%;" &gt;DYNAMIC BINDING&lt;/span&gt;&lt;br /&gt;Binding refers to the linking of a procedure call to be executed in response to the call. &lt;span style="font-style: italic;"&gt;Dynamic binding (also known as late binding) means that the code associated with a given procedure call is not known until the time of the call at run time&lt;/span&gt;. It is associated with polymorphism and inheritance.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 51, 255);font-size:130%;" &gt;MESSAGE PASSING&lt;/span&gt;&lt;br /&gt;In OOP objects communicate with one another by sending and receiving information much the same way as people pass message to one another. The concept of message passing makes it easier to talk about building systems that directly model or simulate their real-world counterparts. &lt;span style="font-style: italic;"&gt;A message for an object is a request for execution of a procedure, and therefore will invoke a function in the receiving object that generates the desired results. Message passing involves specifying the name of the object, the name of the function and the information to be sent.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;Advantages and pretensions of C++&lt;/span&gt;&lt;br /&gt;Often it is said that programming in C++ leads to `better' programs. Some of the claimed advantages of C++ are:&lt;br /&gt;1)New programs would be developed in less time because old code can be reused.&lt;br /&gt;2)Creating and using new data types would be easier than in C.&lt;br /&gt;3)The memory management under C++ would be easier and more transparent.&lt;br /&gt;4)Programs would be less bug-prone, as C++ uses a stricter syntax and type checking.&lt;br /&gt;5)`Data hiding', the usage of data by one program part while other program parts cannot access the data, would be easier to implement with C++.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 102, 255);font-size:130%;" &gt;A FIRST IMPRESSION OF C++&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Introduction&lt;/span&gt;&lt;br /&gt;C++ is the superset of the C programming language that supports object oriented programming (OOP). Hence we can say that C++ cannot be separated from C. C++ is an object oriented programming language and was developed by &lt;span style="font-style: italic;"&gt;Bajarne Stoustrup at AT&amp;T Bell Laboratories&lt;/span&gt; in early 1980’s. Stroustrup an admirer of Simula67 and a strong supporter of C, wanted to combine the best of both the languages and create a more powerful language that could support object oriented programming and still retain the elegance of C. In 1983, the name was changed to C++ with the idea of attaching an increment operator, thereby suggesting that C++ is an augmented (incremented) version of C++.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Applications of C++&lt;/span&gt;&lt;br /&gt;C++ is a versatile language for handling very large programs. It is suitable for virtually any programming tasks&lt;br /&gt;1)Since C++ allows us to create hierarchy-related objects, we can build special object oriented libraries, which can be used later by many programmers.&lt;br /&gt;2)While C++ is able to map the real world problem properly, the C part of C++ gives the language the ability to get close to the machine level details.&lt;br /&gt;3)C++ programs are easily maintainable and expandable.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Getting started&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(102, 51, 51);"&gt;C++ character sets:&lt;/span&gt;&lt;br /&gt;C++ uses the characters set as given below as the building block to form the basic programming elements as identifiers, variable, array etc&lt;br /&gt;&lt;br /&gt;Letters: Upper case A-Z&lt;br /&gt;              Lower case a-z&lt;br /&gt;Digits    0…9&lt;br /&gt;Special characters: / * + “ &lt; # ) ( = | { &gt; % ~ ; } / ^ [ - : ‘ ? &amp; _ ] ` .&lt;br /&gt;&lt;br /&gt;White spaces blank space, horizontal tab(à), carriage return(     ), newline, form feed.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(204, 102, 0);"&gt;Keywords&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Keywords are some reserved words in C++ which have predefined meaning to compiler&lt;/span&gt;. We cannot use keywords as variable name. Some commonly used keywords are:&lt;br /&gt;Auto             extern            sizeof            break             float&lt;br /&gt;Static            case               for                  struct            char&lt;br /&gt;Goto             switch            const              if                   typedef&lt;br /&gt;Continue       do                 short               while            register&lt;br /&gt;Double           return          else                long                void&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/16121640-112819173442851328?l=top-techies.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://top-techies.blogspot.com/feeds/112819173442851328/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=16121640&amp;postID=112819173442851328' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/16121640/posts/default/112819173442851328'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/16121640/posts/default/112819173442851328'/><link rel='alternate' type='text/html' href='http://top-techies.blogspot.com/2005/10/power-of-c.html' title='The Power Of  &apos;C++&apos;'/><author><name>Abhinav</name><uri>http://www.blogger.com/profile/13786912810543719639</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry></feed>
