Tuesday, January 14, 2014

•   A console application is an application that, predominantly, displays text output in either a console
window (or MS-DOS window). This is also called a command prompt.

•   Programmers insert comments to document programs and improve program readability. Every
program should begin with a comment describing the purpose of the program.

•   A comment that begins with // is called a single-line comment, because the comment terminates
at the end of the current line. A // comment can begin in the middle of a line and continue until
that line’s end. Multiple-line comments begin with the delimiter /* and end with delimiter */.
The compiler ignores all text between the delimiters of the comment.

•   A namespace groups various C# features into related categories, providing programmers with the
ability to locate them quickly.



•   The using directive declares the use of a namespace.

•   Programmers use preexisting code to make programming easier and faster.

•   Blank lines, space characters and tab characters are known as whitespace (space characters and
tabs are known, specifically, as whitespace characters). Such characters are ignored by the com-
piler and used to improve program readability.

•   Classes consist of pieces (called methods) that perform tasks and return information (or simply
control) when they complete their tasks. The programmer can program each piece that is needed
to form a C# program.

•   Classes defined by the programmer are known as programmer-defined or user-defined classes.

•   The class keyword introduces a class definition and is followed immediately by the class name.

•   Keywords are reserved for use by C# and are always spelled with lowercase letters.

•   By convention, all class names in C# begin with an uppercase letter and have an uppercase letter
for the beginning of every word in the class name.

•   The name of a class is called an identifier. An identifier is a series of characters, consisting of let-
ters, digits, underscores ( _ ) and “at” symbols (@), that does not begin with a digit and does not
contain any spaces.

•   C# is case sensitive—uppercase and lowercase letters are different, thus a1 and A1 are distinct
identifiers.


•   A left brace ({) begins the body of every class or method definition. A corresponding right brace
(}) must end each class or method definition. If braces do not occur in matching pairs, the compiler
indicates an error.

•   Set a convention for the indent size you prefer and apply that convention uniformly.

•   C# applications begin executing at Main, which is known as the entry point of the program.

•   C# class definitions normally contain one or more methods. C# applications contain one or more
classes. For a C# application, one of the classes in the application must contain method Main.

•   Methods can perform tasks and return information when these tasks complete. Information also
can be passed to a method. This information may be necessary for the method to complete its task
and is called an argument.

•   A string sometimes is called a character string, a message or a string literal.

•   Whitespace characters in strings are not ignored by the compiler.

•   Every statement must end with a semicolon (the statement terminator). Omitting the semicolon at
the end of a statement is a syntax error.

•   A syntax error occurs when the compiler cannot recognize a statement. The compiler normally is-
sues an error message to help the programmer locate and fix the incorrect statement. Syntax errors
are violations of the language’s rules.

•   When the compiler reports a syntax error, the error might not be on the line indicated by the error
message. First, check the line where the error was reported. If that line does not contain syntax
errors, check the preceding several lines in the program.

•   Unlike WriteLine, method Write does not position the output cursor at the beginning of the
next line in the console window after displaying its argument.

•   A single statement can display multiple lines by using newline characters.

•   C# has a version of the + operator for string concatenation that enables a string and a value of an-
other data type (including another string) to be concatenated—the result of this operation is a new
(and normally longer) string.

•   The backslash (\) is called an escape character. It indicates that a “special” character is to be out-
put. When a backslash is encountered in a string of characters, the next character is combined with
the backslash to form an escape sequence.

•   String contents always must be delimited with double quotes.

•   Class MessageBox allows you to display a dialog containing information.

•   Class MessageBox is defined in namespace System.Windows.Forms.

•   The predefined namespaces in C# contain classes that are collectively referred to as the .NET
Framework Class Library.

•   GUI components facilitate data entry by the user and the formatting or presenting of data outputs
to the user.

•   Method MessageBox.Show is a special method of class MessageBox, called a static method.
Such methods are always called with their class name followed by a dot operator (.) and the meth-
od name.

•   Depending on the type of application we create, classes may be compiled into files with a .exe
(executable) extension, a .dll (or dynamic link library) extension or one of several other exten-
sions. This file is called an assembly, which is the packaging unit for code in C#.

•   We need to add a reference to an assembly if we wish to use its classes. References to assemblies
can be created easily in Visual Studio .NET by selecting the Add Reference… option from the
Project menu and finding the necessary.dll.

•   The System.Windows.Forms namespace contains many classes that help C# programmers
define graphical user interfaces (GUIs) for their applications.

•   A message dialog by default includes an OK button that allows the user to dismiss the dialog.

•   A variable is a location in memory where a value can be stored for use by a program.

•   All variables must be declared with a name and a data type before they can be used in a program.

•   A variable name can be any valid identifier.

•   Declarations end with a semicolon (;) and can be split over several lines, with each variable in the
declaration separated by a comma.

•   Several variables of the same type may be declared in either one declaration or separate
declarations.

•   The keywords int, double and char are primitive types.

•   Primitive type names are keywords.

•   A prompt is a message that directs the user to take a specific action.

•   The = operator is called a binary operator, because it has two operands. A statement containing an
= operation is called an assignment statement, because it assigns a value to a variable. The expres-
sion to the right side of the assignment operator = is always evaluated before the assignment occurs.

•   Method Int32.Parse (a static method of class Int32) converts its string argument to an
integer.

•   Sometimes, when displaying strings C# encounters a format. A format specifies a placeholder for
a value that will be inserted in a string.

•   Variable names actually correspond to locations in the computer's memory. Every variable has a
name, a type, a size and a value.

•   Whenever a value is placed in a memory location, this value replaces the previous value in that
location. The previous value is destroyed (lost).

•   When a value is read from a memory location, the process is nondestructive.

•   Integer division yields an integer quotient. Note that any fractional part in integer division is sim-
ply discarded (i.e., truncated)—no rounding occurs.

•   The modulus operator (%) yields the remainder after integer division.

•   Arithmetic expressions must be written in straight-line form to facilitate entering programs into
the computer.

•   Parentheses are used in C# expressions in the same manner as in algebraic expressions.

•   C# applies the operators in arithmetic expressions in a precise sequence determined by the rules
of operator precedence.

•   As in algebra, it is acceptable to place unnecessary (redundant) parentheses in an expression to
make the expression clearer.

•   The if structure allows a program to make a decision based on the truth or falsity of some condition.If the condition is met (i.e., the condition is true), the statement in the body of the if structure exe-
cutes. If the condition is not met (i.e., the condition is false), the body statement does not execute.

•   Conditions in if structures can be formed by using equality operators and relational operators.

•   A string containing no characters is known as an empty string.

•   Every variable declared in a method must be initialized (given a value) before it can be used in an
expression, or a syntax error will occur.

•   A semicolon by itself (not preceded by an actual statement) is known as an empty statement. When an empty statement executes, no task is performed.



0 comments:

Post a Comment

Subscribe to RSS Feed Follow me on Twitter!