In this lesson you will learn how to work with visual studio also you learn how to debug a code to find out issues with your code.
Solution Explorer and Class view
In visual studio we have 2 very important viewes of the project first is Solution explorer that show all the files that you have in your application also you may have different project in a solution. So this view show files like images, your files that have your classes. Second view is Class view where you have all your classes and data types. You may have one file but 2 different classes in it so you see one file in solution explorer however you will see 2 files in class view.
What is namespace?
Namespace is a space that classes or other data types or even other namespaces are defined. And to access these classes we need to tell c# compiler that we are going to use those classes by using keyword. So when you write using System; it means that you can access classes inside system. For example then we can write Console.WriteLine(“Hello world”); we can also write this code like: System.Console.WriteLine(“Hello World”); so we do not need to write Using System. But it does not make sense writing extra “system.” for each call. Namespaces are used to classify classes. For example system.Text or System.xml when you see these namespace you can understand that what sort of classes they have.
How to Debug?
Sometimes you need to debug your code to see what is wrong with them. to do that all you need go to the line that you want to stop the debugger then press f9 then you will see a red line then when you run the code the application will stop in that line then you can see variable by selecting them with mouse. alos you can add them to watch window. you can press f11 or f10 to continue running. f11 will continue running even inside a method. You will see a clip for that don't wory that much.
No comments:
Post a Comment