-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCSharp1_1.html
More file actions
99 lines (87 loc) · 6.8 KB
/
Copy pathCSharp1_1.html
File metadata and controls
99 lines (87 loc) · 6.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<article>
<h1>C# I: Page 1 - Introduction to C# and the .NET Ecosystem</h1>
<section>
<h2>What is C#?</h2>
<p>C# (pronounced "See Sharp") is a modern, object-oriented, and type-safe programming language developed by Microsoft around 2000. It was designed to combine the computing power of C++ with the ease of use of Visual Basic. Celebrated for its versatility, C# has evolved into a cross-platform powerhouse that powers everything from high-performance web servers to triple-A video games (via the Unity engine). Whether you are building enterprise-grade cloud services or sleek mobile apps, C# provides the safety of static typing with the developer productivity of modern language features.</p>
<h3>Key Characteristics:</h3>
<ul>
<li><strong>Strongly Typed:</strong> The compiler catches type-related errors before your code even runs.</li>
<li><strong>Component-Oriented:</strong> Excellent support for modular, reusable software components.</li>
<li><strong>Garbage Collected:</strong> Automatic memory management relieves the developer of manual cleanup.</li>
<li><strong>Cross-Platform:</strong> Runs on Windows, macOS, and Linux via .NET Core and .NET 5+.</li>
</ul>
</section>
<section>
<h2>The .NET Ecosystem</h2>
<p>You cannot understand C# without understanding **.NET**. C# is the language, but .NET is the <strong>Developer Platform</strong> that provides the tools, libraries, and runtime environment to execute your code.</p>
<h3>1. The Runtime: CLR (Common Language Runtime)</h3>
<p>The CLR is the "engine" of .NET. When you compile C# code, it isn't turned into machine code directly. Instead, it's turned into <strong>Common Intermediate Language (CIL)</strong>. The CLR then uses <strong>Just-In-Time (JIT) Compilation</strong> to turn that CIL into machine code for your specific CPU. The CLR also handles garbage collection, exception handling, and thread management.</p>
<h3>2. The Framework: BCL (Base Class Library)</h3>
<p>The BCL is a massive set of pre-built classes and interfaces that handle common tasks. Instead of writing your own logic for file access, encryption, or networking, you just use the standard classes provided by .NET. This "Batteries Included" approach is what makes C# development so fast.</p>
</section>
<section>
<h2>Your First C# Program</h2>
<p>A C# application is built from one or more classes organized into <strong>Namespaces</strong>. The entry point of every program is the <code>Main</code> method.</p>
<h3>Program.cs</h3>
<pre><code class="language-csharp">
using System; // Import the Base Class Library's system functions
namespace MyFirstApp {
class Program {
static void Main(string[] args) {
Console.WriteLine("Hello, World!");
Console.WriteLine("Welcome to the .NET ecosystem.");
}
}
}
</code></pre>
<div class="interactive-sim">
<h3>C# Execution Simulator</h3>
<button class="sim-button" onclick="
const out = document.getElementById('sim-output-cs1-1');
out.innerHTML = 'Console.WriteLine("Hello, World!");<br>';
setTimeout(() => out.innerHTML += '>> Hello, World!', 800);
">Run Simulation</button>
<div id="sim-output-cs1-1" class="sim-output"></div>
</div>
</section>
<section>
<h2>Visual Learning: Video Tutorials</h2>
<p>Get a solid start on C# and .NET with these three videos:</p>
<div style="display: flex; gap: 20px; flex-wrap: wrap; margin-top: 20px;">
<div style="flex: 1; min-width: 250px; background: #eee; padding: 15px; border-radius: 8px;">
<strong>1. C# Tutorial for Beginners (Mosh)</strong><br>
<a href="https://www.youtube.com/watch?v=gfkTfcpWqAY" target="_blank">Watch on YouTube →</a>
<p><small>The first 10 minutes are a perfect introduction to the IDE and basic syntax.</small></p>
</div>
<div style="flex: 1; min-width: 250px; background: #eee; padding: 15px; border-radius: 8px;">
<strong>2. What is .NET? (Official Microsoft)</strong><br>
<a href="https://www.youtube.com/watch?v=f-Kov0XwY_8" target="_blank">Watch on YouTube →</a>
<p><small>Understand the platform, the runtime, and the tools.</small></p>
</div>
<div style="flex: 1; min-width: 250px; background: #eee; padding: 15px; border-radius: 8px;">
<strong>3. How to Install Visual Studio & .NET SDK</strong><br>
<a href="https://www.youtube.com/watch?v=D-z_N7S8_z8" target="_blank">Watch on YouTube →</a>
<p><small>Step-by-step guide to setting up your professional environment.</small></p>
</div>
</div>
</section>
<section>
<h2>Real-World Relationship: The Blueprints and the Factory Manager</h2>
<p>Think of <strong>C# Code</strong> like a set of <strong>Architectural Blueprints</strong>. You describe exactly what the building should look like. However, the blueprints themselves can't be lived in. You send them to a <strong>Factory Manager (The CLR)</strong>. The manager translates your drawings into actual physical instructions for the construction crew (the JIT Compiler). If you want to build the same house in Japan (Linux) or New York (Windows), you don't need new blueprints; the local Factory Manager in each city knows exactly how to read your universal drawings and build the house according to local laws (CPU instructions). This is what makes .NET applications so portable and powerful across the entire world of technology.</p>
</section>
<section>
<h2>References & Additional Learning</h2>
<ul>
<li><a href="https://learn.microsoft.com/en-us/dotnet/csharp/" target="_blank">Official Microsoft C# Documentation</a></li>
<li><a href="https://www.baeldung.com/cs/dotnet-architecture" target="_blank">Baeldung: Introduction to .NET Architecture</a></li>
<li><a href="https://www.w3schools.com/cs/index.php" target="_blank">W3Schools: C# Tutorial</a></li>
<li><a href="https://dotnet.microsoft.com/en-us/languages/csharp" target="_blank">Get Started with C# at DotNet</a></li>
</ul>
</section>
<footer style="margin-top: 40px; padding: 20px; background: #f8f9fa; border-top: 1px solid #dee2e6;">
<div style="display: flex; justify-content: space-between;">
<span> </span>
<a href="#" data-file="CSharp1_2.html" style="font-weight: bold; text-decoration: none; color: #007bff;">Next: Variables & Primitives →</a>
</div>
</footer>
</article>