لو مفهمتش حاجات كتير هنا عادي ممكن تقرأها بعد فترة هتفهم
-
We have Folder per Solution and inside it, We have
sln
file just configuration file for my solution and projects -
Inside solution, We have folder per every project
-
And inside project, We have also configuration file for project
-
we can change some Properties for project by (right click it ⇒ Properties)
-
To add file, That I should write could in it (add ⇒ class)
C# Syntax
-
أي حاجة في ال .NET هي عبارة عن pure OOP فدايمًا هتلاقي نفسك بتستخدم الـ Classes
-
فعشان كدا الـ function (main) مينفعش تتكتب في الهوا، لازم تتكتب جوا class
-
وقبل الـ class لازم أعرف الـ namespace
-
وجوا الـ class ببدأ أعرف ال main function بتاعتي ولازم تبقا static void عشان دي ال startup بتاعتي اللي هي أول حاجة هنفذها
-
وافتكر ان اللي بينادي الـ main هو ال CLR اللي اتكلمنا عليه في DotNet Story فعشان يندهلها يعرف يندهلها على طول مش يعمل object من class الـ main وبعدها يندهلها
namespace HWNS
{
class Program
{
public static void Main()
{
System.Console.WriteLine("Hello World");
}
}
}
namespace
is used to organize your code, and it is a container for classes and other namespaces.
وشرح ال Cs Output هنا
using
- لما تلاقي عندك datatype مش موجودة على مستوى ال namespace HWNS روح دور عليه ف الـ namespace اللي اسمه System
- It means that we can use classes from the
System
namespace
using System;
namespace HWNS
{
class Program
{
public static void Main()
{
Console.WriteLine("Hello World!")
}
}
}
- فيه بعض ال namespaces بتبقا متعرفة global تلقائي في فايل اسمع global using
Important about C#
- Case sensitive
- Pascal Case (
BackgroundColor
)