C# LANGUAGE BASICS

M.SARULATHA
Assistant Professor
Dept. of CA,JJC.    

 New C # programs are sometimes intimidated by quirky syntax language, which includes special characters such as semicolons (;), brings curly {}, and retrospective (\). Fortunately, once you get used to C #, this data will melt quickly in the background. In the following sections, you will learn about four common principles that you need to know about C # before learning any other concepts.

2.2.1. Case Sensitivity

    Some languages ​​are resilient, while others are not. Java, C, C ++, and C # are all examples of sensitive languages. VB does not exist. This discrepancy may concern former VB programmers who do not recognize that keywords, variables, and functions should be included in the appropriate case. For example, if you try to create a conditional statement on C # by logging in If, instead, your code will not be recognized, and the compiler will accidentally flag it when you try to build your app.

    C # also has a definite definition of small words. Words that are bold - like, because, foreach, tense, typof, etc. - are often written in lower case. When defining your own flexibility, it makes sense to follow the meetings used by other C # program editors and the NET College library. That means you have to provide private keywords that start with a lower case letter and then provide public variable names that start with a lowercase letter. For example, you can name a different MyNumber private in VB and MyNumber in C #. Of course, you do not need to follow this style as long as you make sure you use the same capitalization consistently.

NOTE

    When you create code that other developers may see (for example, you create items you want to sell to other companies), the encoding standards are very important. Visual Studio's help contains information about coding standards, and you can find a good summary of how to do good on the white "Design C # Coding Standard" by Juval Lowy, available at wideside.net.

2.2.2. Thinking

    Comments are descriptive text that the compiler ignores. C # provides two basic types of comments. The first type is a single list comment. In this case, the comment begins with a double whammy and continues with the current line. Optionally, C # program editors can also use multiple captions using * * and * / / brackets. This trick is often used to quickly code the entire code. This way the code will not be used, but it will still continue your source code file if you need to refer to it or use it as follows:

// One comment comment C #.

/ * Multiline

   C # comment. * /

    C # also includes XML-based comment syntax that you can use to decipher your code in a standard way. For XML comments, you use special tags that indicate whether your comment applies to the class, method, parameter and more. Here is an example of commenting to provide a summary of the entire application:

/// <summary>

/// This app provides web pages

/// via my e-commerce site.

/// </summary>

    XML comments usually start with a triple hit. The advantage of XML-based comments is that automated tools (including Visual Studio) can extract comments from your code and use them to create help references and other types of text.

2.2.3. Completion of the statement

    C # uses the semicolon (;) as a character to end a sentence. All statements in code C # must end with this semicolon, unless you define a block structure such as a method, conditional statement, or looping build. By dropping this semicolon, you can easily split the code statement over multiple lines of flesh. You just need to remember to place the semicolon at the end of the last line, to complete the statement.

    The following snippet code shows four similar ways of doing the same task (inserting three numbers together):

// The code statement separated the two lines.

myValue = myValue1 + myValue2 +

          myValue3;

// The code statement separated the three lines.

myValue = myValue1 +

          myValue2 +

          myValue3;

// Code statement in one line.

myValue = myValue1 + myValue2 + myValue3;

// Two coding statements in a row.

myValue = myValue1 + myValue2;

myValue = myValue + myValue3;

Example:

    C # gives you a wide range of freedom to classify your statement in any way you want. A common rule of thumb is to make your code as readable as possible. So, if you have a long statement, spread this statement over several lines so it is easy to read.

    Alternatively, if you have a complex code statement that performs many functions simultaneously, you can distribute this statement in several lines or split your points into multiple code statements to make it clear.

2.2.4. Blocks

    C #, Java, and C languages ​​all rely heavily on curved parentheses: {}. You can find curly brows on the right side of most keyboards (next to the P button); they share keys with square brackets [].

    Curly puts many pieces of code together. Usually, the reason you want to compile code statements together is because you want them to be duplicated, processed, or programmed. You will see all these skills in this chapter. But in each case, brings curly plays the same role, making C # easier and shorter than other languages ​​that require is a different syntax for each type of block structure:

{

    // Code statements go here.

}

Comments

Popular posts from this blog

Operating System Structure

Asymptotic Notations

ASP.NET Events Handling