C# 6 for Programmers
C# 6 for Programmers

Bibliography
- Author: Paul Deitel
- Full_Title: C# 6 for Programmers
- Category: books
- Last Highlighted Date: 2024-02-08 16:55:58.855429+00:00
Highlights
- Line 1 begins with
//, indicating that the remainder of the line is a comment. We begin every source-code file with a comment indicating the figure number and the name of the file in which the code is stored.- View Highlight, Open in Readwise ^rw674116464
- using System;
is a using directive that tells the compiler where to look for a class that’s used in this app. 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—named collections of related classes.
- View Highlight, Open in Readwise ^rw674116904
- Whitespace is ignored by the compiler.
- View Highlight, Open in Readwise ^rw674117076
- class Welcome1
begins a class declaration for the class named
Welcome1. Every app consists of at least one class declaration that’s defined by you. These are known as user-defined classes.- View Highlight, Open in Readwise ^rw674117240
- By convention, all class names begin with a capital letter and capitalize the first letter of each word they include (e.g.,
SampleClassName).- View Highlight, Open in Readwise ^rw674117311
- C# is case sensitive
- View Highlight, Open in Readwise ^rw674117374
- A class declaration’s file name is usually the class name followed by the
.csfile-name extension- View Highlight, Open in Readwise ^rw674117501
- By convention, a file that contains a single class should have a name that’s identical to the class name
- View Highlight, Open in Readwise ^rw674117547
- A left brace,
{(in line 6 in Fig. 3.1), begins each class declaration’s body. A corresponding right brace,}- View Highlight, Open in Readwise ^rw674117736
- static void Main()
is where the app begins execution—this is known as the entry point. The parentheses after the identifier
Mainindicate that it’s a method. Class declarations normally contain one or more methods.- View Highlight, Open in Readwise ^rw674117803
- The left brace in line 9 begins the body of the method declaration. A corresponding right brace ends the body (line 11). Line 10 in the method body is indented between the braces
- View Highlight, Open in Readwise ^rw674117873
- Console.WriteLine(“Welcome to C# Programming!”);
instructs the computer to perform an action—namely, to display the string of characters between the double quotation marks, which delimit the string.
- View Highlight, Open in Readwise ^rw674117915
- The entire line 10, including
Console.WriteLine, the parentheses, the argument"Welcome to C# Programming!"in the parentheses and the semicolon (;), is called a statement. Most statements end with a semicolon.- View Highlight, Open in Readwise ^rw674117968
- By convention, variable-name identifiers begin with a lowercase letter, and every word in the name after the first word begins with a capital letter (e.g., firstNumber). This naming convention is known as camel case.
- View Highlight, Open in Readwise ^rw674131650
- C# also offers a technology called exception handling that will help you make your apps more robust by enabling them to handle exceptions and continue executing.
- View Highlight, Open in Readwise ^rw674133811
Tags: