Friday, 7 March 2014

How to create a console application.Explain solution explorer,Properties window,Error list window functions.

Console applications
Create a new console application project by selecting File->New->Project or by pressing key shortcut or by clicking on corresponding icon in the toolbar.
Select visual C# in project types,console applications in templates,change location and other settings as they are.
Click on button.
Once project is initialized add following lines of code to the file displayed in main window.

namespace ConsoleApplication1
    class Program
        static void main(string[] args)
        Console.WriteLine("The first app beggining in c# programming!");
Select debugg->start menu item or press a keyboard shortcut or a toolbar icon.You will see result in few minutes.
The first app beggining in c# programming!
Press a key to exit the application .
The console application will terminate as soon as they finish execution,ie, you don't get a chance to see result.To get around here code is told to wait for a key press before terminating.You will see this technique  used in many examples.

Solution explorer
This shows files in ConsoleApplication1.project created here.The code added file here is program.cs,It is shown along with another code file assemblyInfo.cs and a resource.cs file.
Remember all C# files have a .cs file extension .
Function done here is renaming file,deleting them from your project.Other types file are resource files such as bitmap images and sound files not c# codes here.
Reference entry contains list of .net libraries used in your project.

Properties window
It shows additional information about whatever you select in the window above.Changes made in this window will affect the code directly.

Error list window
It displays error when error exist in the code.Like missing of semicolon etc..The error shown is double clickedthen cursor will jump to the error in source code.Here you can fix it quickly.Also can see red wavy lines at position of errors in code.Error is shown by line number.If line numbers are not displayed in VS editor ,turn it on through Tools->options menu item ->Text Editor->General here tick auto list members

No comments:

Post a Comment