تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
Your first line of C# code اكتب اول كود في السي شارب
#1
السلام عليكم
كل عام وأنتم بخير
الموضوع برمته منقول كما نوهت في المشاركة السابقة وسامحوني احب اللغة العربية كثيرا وعلى استعداد بإذن الله لمناظرة
اكبر دكاترة اللغة العربية وبثقة ! 
ولكني في مجال البرمجة خصوصا عندما تقابلني شاشة الكيمبيوتر احب ان اتعلم لغة اخرى كالانجليزية والاسبانية والبرتغالية
وهممت بالكورية لكني لم اجد لها معلما متواضعا !!! 
الان هذه المواضيع في الشي شارب ليست موجهة إلا للمبتدئين فيها امثالي بالفعل انا في محو الامية قد اجد من يأخذ بيدي وقد أجد من يسخر او يثبط الهمم لكنني ماض قدماً فالمرء متعلم حتى يموت
لم اجد برنامج قوياً تمت برمجته على البيسك مع حبي لها خصوصا انني في المحرر كأنني اتخاطب مع شخص عاقل وليس مع الة
If then
لكن الحب لا يغني عن في العلم شيئا .... يكفي هرج؟ طيب
الان Your first line of C# code
افتح الفيجوال واختر console application  اقل شي تابع الصور ترجمة جوجل تجيب المرض
[صورة مرفقة: program_tab.gif] 
For now, ignore the lines that start with using as we'll get to them later in the course. But they add references to in-built code. The namespace line includes the name of your application. A namespace is a way to group related code together. Again, don't worry about the term namespace, as you'll learn about these later.
The thing that's important above is the word class. All your code will be written in classes. This one is called Program (you can call them anything you like, as long as C# hasn't taken the word for itself). But think of a class as a segment of code that you give a name to.
Inside of the class called Program there is this code:
static void Main(string[ ] args)
{

}
This piece of code is something called a Method. The name of the Method above is Main. When you run your programme, C# looks for a Method called Main. It uses the Main Method as the starting point for your programmes. It then executes any code between those two curly brackets. The blue words above are all special words - keywords. You'll learn more about them in later chapters.
But position your cursor after the first curly bracket, and then hit the enter key on your keyboard:
The cursor automatically indents for you, ready to type something. Note where the curly brackets are, though, in the code above. You have a pair for class Program, and a pair for the Main method. Miss one out and you'll get error messages.
The single line of code we'll write is this (but don't write it yet):
Console.WriteLine("Hello C Sharp!");
First, type the letter "C". You'll see a popup menu. This popup menu is called the IntelliSense menu. It tries to guess what you want, and allows you to quickly add the item from the list. But it should look like this, after you have typed a capital letter "C":
[صورة مرفقة: code_console.gif]
The icon to the left of the word Console on the list above means that it is a Class. But press the Enter key on your keyboard. The word will be added to your code:
Now type a full stop (period) immediately after the word Console. The IntelliSense menu appears again:
[صورة مرفقة: code_console2.gif] 
You can use the arrow keys on your keyboard to move up or down the list. But if you type Writeand then the letter L of Line, IntelliSense will automatically move down and select it for you:
[صورة مرفقة: code_console3.gif] 
Press the Enter key to add the word WriteLine to your code:
Now type a left round bracket. As soon as you type the round bracket, you'll see this:
[صورة مرفقة: code_console4.gif] 
WriteLine is another Method (A Method is just some code that does a particular job). But the yellow box is telling you that there are 19 different versions of this Method. You could click the small arrows to move up and down the list. Instead, type the following:
"Hello C Sharp!"
Don't forget the double quotes at the start and end. These tell C# that you want text. Your code will look like this:
Now type a right round bracket:
Notice the red wiggly line at the end. This is the coding environment's way of telling you that you've missed something out.
The thing we've missed out is a semicolon. All complete lines of code in C# must end with a semicolon. Miss one out and you'll get error messages. Type the semicolon at the end and the red wiggly line will go away. Your code should now look like this:
Note all the different colours. Visual C# colour-codes the different parts of your code. The reddish colour between double quotes means that you want text; the green colour means it's a Class; blue words are ones that C# reserves for itself.
(If you want, you can change these colours. From the menu bar at the top, click Tools > Options. Under Environment, click Fonts and Colors.)
Time now to Build and Run your code!
طيب الان تالع كيف تبني هذا الكود اللي انت سويته
بالمناسبة الشرح تفصيلي فوق وممل  يتكلم حتى عن تعابير الالوان المختلفة
ما علينا نكمل مع الاجنبي هذا
How to Run your C# Program
كيف تشغل برنامجك؟
You can test your programme a number of ways. First, though, it has to be built. This is when everything is checked to see if there are any errors. Try this:
  • From the View menu at the top of Visual C# Express, click Output. You'll see a window appear at the bottom. (In C# 2010, if you can't see an Output entry, click the Tools menu. From the Tools menu, select Settings > Expert Settings. The Output menu item should then appear on the View menu.)

  • From the Build menu at the top of Visual C# Express, click Build Solution

  • You should see the following report:
The final line is this:
Build: 1 succeeded or up-to-date, 0 failed, 0 skipped
That's telling you that everything is OK.
Now try this:
  • Delete the semicolon from the end of your line of code

  • Click Build > Build Solution again

  • Examine the output window
This time, you should see these two lines at the end of the report:
Compile complete -- 1 errors, 0 warnings
Build: 0 succeeded or up-to-date, 1 failed, 0 skipped

So it's telling you that it couldn't build your solution because there was 1 error.
Put the semicolon back at the end of the line. Now click Debug from the menu at the top of Visual C# Express. From the Debug menu, select Start Debugging.
You should see a black DOS window appear and then disappear. Your programme has run successfully!
To actually see your line of text, click Debug > Start Without Debugging. You should now see this:
And that's your programme! Have a look at the Solution Explorer on the right. Because the project has been built, you'll see more files under Debug:
[صورة مرفقة: solution_explorer_debug.gif]
We now have a ConsoleApplication1.exe and ConsoleApplication1.pdb. The exe file is an executable programme, and it appears in the bin/debug folder. Switch back to Windows Explorer, if you still have it open. You'll see the exe file there:
You could, if you wanted, create a desktop shortcut to this exe file. When you double click the desktop shortcut, the programme will run.
But that's enough of Console Applications - we'll move on to creating Windows Applications.
اوكي الى هنا الرجال يقول هذا كافي في الكونسول وتعال نشتغل واجهات ويندوز
بالمناسبة الشرح على فيجوال استوديو  2010 وشكل الويندوز ملينيوم او 98
شايفين كيف احنا فالحين بس في اقتنا احدث الاجهزة والانظمة؟
Shy
الدرس القادم اول تطبيق على الويندوز فوم
تجده هنا

http://vb4arb.com/vb/thread-13298.html

ريقي نشف من كثر الهرج
في امان الباري
سبحان الله والحمدلله ولا إله إلا الله والله أكبر
 رَبِّ اغْفِرْ لِي وَلِوَالِدَيَّ
Heart
الرد }}}}
تم الشكر بواسطة: الشاكي لله , Sajad , Sajad


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  [C#.NET] موقع دورة سي شارب مجانية الشاكي لله 3 2,187 20-11-16, 07:34 PM
آخر رد: طارق جمعه محمد
Big Grin [C#.NET] دروس فيديو لتعليم سي شارب من البداية حتى الإحتراف باحطاب سوفت 7 6,025 17-10-16, 11:02 PM
آخر رد: بوجهور
  للمبتدئين في السي شارب _ كيفية الاتصال بقاعدة البيانات والتعامل معها أبو عمر 7 1,890 16-09-16, 11:22 PM
آخر رد: أبو عمر
Thumbs Up [سؤال] مشكلة في الكوكيز سي شارب ahmed b skafi 0 198 26-08-16, 12:58 AM
آخر رد: ahmed b skafi
  المتغيرات في السي شارب أبو عمر 0 647 27-09-15, 02:12 PM
آخر رد: أبو عمر
  دورة قواعد البيانات MySQLولغة سي شارب المبرمج الطموح88 1 811 01-08-15, 08:15 AM
آخر رد: ابو ابراهيم
  دورة قواعد البيانات SQLite ولغة سي شارب المبرمج الطموح88 0 902 23-04-15, 04:32 PM
آخر رد: المبرمج الطموح88

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم