Busy. Please wait.
or

show password
Forgot Password?

Don't have an account?  Sign up 
or

Username is available taken
show password

why


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
We do not share your email address with others. It is only used to allow you to reset your password. For details read our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.
Don't know
Know
remaining cards
Save
0:01
To flip the current card, click it or press the Spacebar key.  To move the current card to one of the three colored boxes, click on the box.  You may also press the UP ARROW key to move the card to the "Know" box, the DOWN ARROW key to move the card to the "Don't know" box, or the RIGHT ARROW key to move the card to the Remaining box.  You may also click on the card displayed in any of the three boxes to bring that card back to the center.

Pass complete!

"Know" box contains:
Time elapsed:
Retries:
restart all cards
share
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how

Chapter 3

Introduction to C# Apps

TermDefinition
Console Apps Apps that input and output text in a console window, which in Windows is known as the Command Prompt
Code Walkthrough Discussing each line of code in an app
Comment Used for documenting and improving readability in apps. The C3 compiler ignores comments, so they do not cause the computer to perform any action when the app is run. We begin every app
Single-Line Comment A comment that begins with //. Terminates at the end of the line on which it appears
Delimited Comment Such as, /*This is a delimited comment.*/, can be split over several lines. This types of comment begins with the delimiter /* and ends with the delimiter */. All text between the delimiters is ignored by the compiler.
Syntax The syntax of a programming language specifies the rules for creating a proper app in that language.
Syntax Error Occurs when the compiler encounters code that violates the C# language rules. Also called compiler errors, compile-time errors, or compilation errors, because the compiler detects them during the compilation phase
Using Directive A line of code that tells the computer where to look for a class that's used in an app. Each using directive identifies a namespace containing predefined classes that a C# app should by able to use. Ex: using System;
Visual C#'s Predefined Classes A great strength of Visual C# is its rich set of predefined classes that you can reuse rather than "reinventing the wheel". These classes are organized under namespaces
Namespaces Named collections of related classes. Collectively, .NET's namespaces are referred to as the .NET Framework Class Library.
Whitespace Blank lines, space characters, and tab characters. Make code easier to read. Space characters and tabs are known specifically as whitespace characters. Whitespace is ignored by the compiler
Class Declaration Every app consists of at least one class declaration that's defined by the programmer. These are known as user-defined classes. The class keyword introduces a class declaration and is immediately followed by the class name
Keywords(Reserved Words) Words reserved for use by C# and are always spelled with all lowercase letters.
Upper Camel Casing By convention, all class names begin with a letter and capitalize the first letter of each work they include. Ex: SampleClassName
Identifier A class name is an identifier which is a series of characters consisting of letters, digits, and underscores(_) that does not begin with a digit and does not contain spaces. Does not begin with a capital letter and is not the name of a class
C# is Case Sensitive Uppercase and lowercase letters are distinct, so a1 and A1 are different(but both valid) identifiers
Convention for Naming Public Classes By convention, a file that contains a single public class should have a name that's identical to the class name(plus the .cs extension in both spelling and capitilization)
Body of a Class Declaration A left brace, {, begins the body of every class declaration. A corresponding right brace, }, must end each class declatation
Class Indentation Convention Indent th entire body of each class declaration one "level" of indentation between the left and right braces that delimit the body of the class. This format emphasizes the class declaration's structure and makes t easiier to read
Method An app building block that have set of parentheses after them. Method names usually follow same conventions as classes. Each app must contain method called main or app will not execute. Able to perform tasks and return information when tasks are complete
Void The keyword void before a method indicates that a method will not return any information after it completes its task. Many methods do return information
Method Indentation Convention As with class declarations, indent the entire body of each method declaration one "level" of indentation between the left and right braces that define the method body
String(Character String, Message, Literal String) A string of characters
Class Console Provides standard input/output capabilities that enable apps to read and display text in the console window from which the app executes
Console.WriteLine Method Displays a line of text in the console window
Statement Console.WriteLine("Welcome to C# Programming!");, is called a statement. Most statements end with semicolon. This statement displays the message, "Welcome to C# Programming!", in console window. The string in the parentheses is the argument to the method
Syntax-Color Highlighting The code coloring scheme used by the IDE. Helps you visually differentiate app elements
IntelliSense Lists various items that start with or contain the letters you've typed so far in the visual studio editor window. Also displays a tool tip containing a description of the first matching item
Parameter Info Wiindow This window contains information about a method's parameters.
Overloaded Methods The concept that a class can define several methods that have the same name, as long as they have different number and/or types of paraemters
Assemblies Depending on the project's type, the compiler may compile the code into files with the exe. extension(executable), the .dll(dynamically linked library) extension or one of several other extensions and are the packaging units for compiled C# code
Escape Character The backslash(\) is called an escape character. It indicated to C# that a "special character" is in the string.
Escape Sequence When a backslash appears in a string of characters, C# combines the next character with the backslash to form an escape sequence.
Newline Character The escape sequence \n represents the newline character. This causes the screen cursor to move to the beginning of the next line in the console window.
1. Common Escape Sequences 1. \n..Called newline. Positions the screen curson at the beginning of the next line... 2. \t...Called horizontal tab. Moves the screen cursor to the next tab stop...
2. Common Escape Sequences 3. \"..CalleddDouble quote. Used to place a double-quote character(") in a string. Ex: Console.Write("\"in quotes\""); displays the string, "in quotes"...
3 Common Escape Sequences 4. \r..Called carriage return. Positions the screen cursor at the beginning of the current line - does not advance the cursor to the next line. Any character output after the carriage return overwrite the characters previously output on that line
4. Common Escape Sequences 5. \\..Called backslash. Used to place a backslash character in a string
Format Strings May consist of fixed text and format items.
Format Items Each one is a placeholder of a value. Are enclosed in curly braces and contain characters that tell method which argument to use and how to format it. The format item {0} is a placeholder for first additional argument, {1} is second placeholder, and so on
Variable A location in the computer's memory where a value can be stored for use later in an app. Are typically declared with a name and a type before they're used. Every variable has a name, a type, a size(determined by the type), and a value
Variable Name Enables the app to access the value of the variable in memory - the name can be any valid identifier
Variables Types Specifies what kind of information is stored at that location in memory and how much space should be set aside to store that value
Variables Use in Apps Apps remember numbers and other data in the computer's memory and access that data through these app elemetns
Variable Declaration(Declaration) Specifies the name and type of variable used in an app
Type int Variable Hold integer values. The range of values for an int is -2,147,483,648(int.MinValue) to 2,147,483,647(int.MaxValue)
Type float and double Variable Sore approximations of real numbers in memory
Type decimal Variable Store real numbers precisely(to 28-29 significant figures), so decimal variable are often used with monetary calculations
Simple Type Variables Types such as int, float, double, decimal, and char. Simply-type names are keywords and must appear in all lowercase letters
Prompt Directs the user to take a specific action
Console's ReadLine Method Waits for the user to type a string of characters at the keyboard and press the Enter key. Returns the text the user entered
Class Convert's ToInt32 Method Converts a sequence of characters into data of type int
Exception Handling C# offers a technology called exception handling that will help you make your apps more robust by enabling them to handle exceptions and continue executing. This is also known as making you app fault tolerrant
Assignment Operator The symbol = can be used to assign values to variables. Operator = is a binary operator, because it works on two pieces of information. These are known as operands.
Assignment Statement A statement that assigns a value to a variable. Everything to the right of the assignment operator, =, is always evaluated before the assignment is performed
Expression Portions of statements that contain calculations
1. C# Operations 1. Addition..Arithmetic Operator(+)..Algebraic Expression(f + 7)..C# Expression(f + 7).. 2. Subtraction..Arithmetic Operator(-)..Algebraic Expression(p - c)..C# Expression(p - c)..
2. C# Operations 3. Multiplication..Arithmetic Operator(*)..Algebraic Expression(b * m)..C# Expression(b * m).. 4. Division..Arithmetic Operator(/)..Algebraic Expression(x / y)..C# Expression(x / y)..
3. C# Operations 5. Remainder..Arithmetic Operator(%)..Algebraic Expression(r mod s)..C# Expression(r % s)..
Straight-Line Form Arithmetic expressions must be written in straight-line form to facilitate entering apps into the computer
Nested Parentheses If an expression contains nested parentheses, such as ((a + b) * c), the expression in the innermost set of parenthese
Operator Precedence C# applies the operators in arithmetic expressions in a precise sequence determined by the rules of operator precedence, which are generally the same as those followed in algebra
Precedence of Arithmetic Operators Rules Evaluated first(evaluated from left to right)... 1. Multiplication.. 2. Division.. 3. Remainder... Evaluated second(evaluated from left to right)... 4. Addition.. 5. Subtraction
Associativity When we say that operators are applied from left to right, we're referring to their associativity
Redundant Parentheses Unnecessary parentheses in an expression which have the purpose of making an expression clearer. These are acceptable
Condition An expression that can be either true or false
C#'s if Statement Allows an app to make a decision based on the value of a condition. If the condition in an if statement is true, the body of the if statement executes. If the condition is false, the body does not execute. No semicolon at the end of the first line.
1. Equality and Relational Operators Conditions in if statements can be formed by using the equality operators(== and !=) and relational operators(>, <, >=, <=).
2. Equality and Relational Operators The two equality operators have same level of precedence, the relational operators each have the same level of precedence, and the equality operator have lower precedence than the relational operators
Comparing Equality Operator and Assignment Operators Confusing the equality operator, ==, with the assignment operator, =, can cause a logic error or a syntax error. The equality operator should be read as "is equal to" and the assignment operator should be read as "gets" or "gets the value of"
Empty Statement When the semicolon is in the line by itself
1. Precedence and Associativity of Operations 1. Operators(*, /, %)...Associativity(left to right)...Type(multiplicative)... 2. Operators(+, -)...Associativity(left to right)...Type(additive).. 3. Operators(<, <=, >, >=)...Associativity(left to right)...Type(relational)....
2. Precedence and Associativity of Operations 4. Operators(==, !=)...Associativity(left to right)...Type(equality)... 5. Operators(=)...Associativity(right to left)...Type(assignment)...
Type char Variable Specifies character data. Represent individual characters, such as an uppercase letter, a digit, a special character or an escape sequence
if Statement Setup An if statement always begins with keyword if, followed by a condition in parentheses, and expects one statement in its body
Created by: TimC#Programming