From 4979c6adce930546fa14a242c2d7357b20305a1e Mon Sep 17 00:00:00 2001 From: Brad Germain Date: Thu, 13 Jan 2022 12:52:40 -0500 Subject: [PATCH 1/3] Created general terms section and added in some general .NET terms --- cs.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cs.md b/cs.md index 00378dd..1a69a44 100644 --- a/cs.md +++ b/cs.md @@ -131,4 +131,13 @@ for(int i = 0; i < numbers.Length; i++) { foreach(int num in numbers) { Console.WriteLine(num); } -``` \ No newline at end of file +``` + +### General .NET Terms + +| Term | Definition | +|------------|-------- +| Runtime | A collection of services that are required to execute a given compiled unit of code. +| Common Language Runtime (CLR) | Primarily locates, loads, and managed .NET objects. The CLR also handles memory management, application hosting, coordination of threads, performaing security checks, and other low-level details. +| Managed code | Code that compiles and runs on .NET runtime. C#/F#/VB are examples. +| Umanaged code | Code that compiles straight to machine code and cannot be directly hosted by the .NET runtime. Contains no free memory management, garbage collection, etc. DLLs created from C/C++ are examples. \ No newline at end of file From 6b63e69004dd8c64dd5892948318cf1b67bb99be Mon Sep 17 00:00:00 2001 From: Brad Germain Date: Thu, 13 Jan 2022 13:10:34 -0500 Subject: [PATCH 2/3] Added comments section --- cs.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/cs.md b/cs.md index 1a69a44..b97d62c 100644 --- a/cs.md +++ b/cs.md @@ -33,6 +33,22 @@ $ dotnet run Hello, world! ``` +### Comments +```cs +// Single-line comment + +/* Multi-line + comment */ + +// TODO: Adds comment to a task list in Visual Studio + +/// Single-line comment used for documentation + +/** Multi-line comment + used for documentation **/ + +``` + ### Variables ```cs From 3a98d1e5196ac0fc4ffb4ec1a332799688572c2f Mon Sep 17 00:00:00 2001 From: Brad Germain Date: Thu, 13 Jan 2022 14:02:44 -0500 Subject: [PATCH 3/3] A few fixes, updated strings, added string members --- cs.md | 44 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/cs.md b/cs.md index b97d62c..ca4e5b7 100644 --- a/cs.md +++ b/cs.md @@ -86,15 +86,40 @@ var bo = false; string first = "John"; string last = "Doe"; +// string concatenation string name = first + " " + last; Console.WriteLine(name); // => John Doe ``` --- -``` -// Or string interpolation -string name = $"{first} {last}" +```cs +// string interpolation +string name = $"{first} {last}"; Console.WriteLine(name); // => John Doe ``` +--- +```cs +// verbatim strings +string longString = @"I can type any characters in here !#@$%^&*()__+ '' \n \t except double quotes and I will be taken literally. I even work with multiple lines."; +``` +#### String Members +```cs +// Using property of System.String +string lengthOfString = "How long?"; +Console.WriteLine(lengthOfString.Length); // => 9 + +// Using methods of System.String +Console.WriteLine(lengthOfString.Contains("How")); // => true +``` +| String Member | Description | +|---------------|-------------| +| Length | A property that returns the length of the string. | +| Compare() | A static method that compares two strings. | +| Contains() | Determines if the string contains a specific substring. | +| Equals() | Determines if the two strings have the same character data. | +| Format() | Formats a string via the {0} notation and by using other primitives. | +| Trim() | Removes all instances of specific characters from trailing and leading characters. Defaults to removing leading and trailing spaces. | +| Split() | Removes the provided character and creates an array out of the remaining characters on either side. | +{.show-header} ### User Input @@ -143,7 +168,7 @@ for(int i = 0; i < numbers.Length; i++) { } ``` --- -``` +```cs foreach(int num in numbers) { Console.WriteLine(num); } @@ -152,8 +177,9 @@ foreach(int num in numbers) { ### General .NET Terms | Term | Definition | -|------------|-------- -| Runtime | A collection of services that are required to execute a given compiled unit of code. -| Common Language Runtime (CLR) | Primarily locates, loads, and managed .NET objects. The CLR also handles memory management, application hosting, coordination of threads, performaing security checks, and other low-level details. -| Managed code | Code that compiles and runs on .NET runtime. C#/F#/VB are examples. -| Umanaged code | Code that compiles straight to machine code and cannot be directly hosted by the .NET runtime. Contains no free memory management, garbage collection, etc. DLLs created from C/C++ are examples. \ No newline at end of file +|------------|------------| +| Runtime | A collection of services that are required to execute a given compiled unit of code. | +| Common Language Runtime (CLR) | Primarily locates, loads, and managed .NET objects. The CLR also handles memory management, application hosting, coordination of threads, performaing security checks, and other low-level details. | +| Managed code | Code that compiles and runs on .NET runtime. C#/F#/VB are examples. | +| Umanaged code | Code that compiles straight to machine code and cannot be directly hosted by the .NET runtime. Contains no free memory management, garbage collection, etc. DLLs created from C/C++ are examples. | +{.show-header}