Skip to main content

C# Programming Structure | WaoFamHub



C# Programming Structure.

C# Programming Language


The lists of elements that are commonly used in a C# program are:

Library invoked by the keyword "using".
Declaring namespace using the "namespace" keyword.
Declaring a class using the keyword "class".
Class members and attributes.
The Main() method.
Other statements and expressions.
Writing comments for user understanding and non-executable statements.

Let's look into various parts of the above C# program.

/* Comments */

/* Print, some string in C# */, is the comment statement that does not get executed by the compiler and is used for code readers or programmers' understanding.

using

Here, using keyword is employed for fetching all the associated methods that are within the System namespace. Any C# program can have multiple using statements.

namespace

Next statement is used for declaring a namespace, which is a collection of classes under a single unit; here "printHelloCsharp".

Class

Next, you have declared a class "HelloCsharp" using the keyword class, which is used for preserving the concept of encapsulation.

main()

Inside a class, you can have multiple methods and declaring variable names. The static/void is a return value, which will be explained in a while.

Console.WriteLine()

Console.WriteLine() is a predefined method used for displaying any string or variable's value in a C# program.

Console.ReadKey()

Console.ReadKey() is another predefined method used to make the program wait for any key-press.


Comments

Post a Comment

Popular posts from this blog

Software Engineering - RAD (Rapid Application Development) Model | WaoFamHub

RAD (Rapid Application Development) Model RAD is a linear sequential software development process model that emphasizes a concise development cycle using an element based construction approach. If the requirements are well understood and described, and the project scope is a constraint, the RAD process enables a development team to create a fully functional system within a concise time period. RAD (Rapid Application Development) is a concept that products can be developed faster and of higher quality through: Gathering requirements using workshops or focus groups Prototyping and early, reiterative user testing of designs The re-use of software components A rigidly paced schedule that refers design improvements to the next product version Less formality in reviews and other team communication The various phases of RAD are as follows: 1.Business Modelling: The information flow among business functions is defined by answering questions like what data drives the business process, what data...

Write a java program to add two matrices and print the resultant matrix | WaoFamHub

Add two matrices and print the resultant matrix. INPUT public class Matrix{ public static void main(String args[]){  int a[][]={{1,3,4},{2,4,3},{3,4,5}};  int b[][]={{1,3,4},{2,4,3},{1,2,4}};    int c[][]=new int[3][3];    for(int i=0;i<3;i++){  for(int j=0;j<3;j++){  c[i][j]=a[i][j]+b[i][j];  System.out.print(c[i][j]+" ");  }  System.out.println();  }  }} OUTPUT

Perform 2D Rotation On A Given Object Program In C | WaoFamHub

2D Rotation On A Given Object Program INPUT #include<stdio.h> #include<graphics.h> void main() { int gd=DETECT,gm; initgraph(&gdriver,&gmode,"C//TurboC3//BGI"); int x1,y1,x2,y2 ; float b1,b2; float t,deg; printf(“Enter the coordinates of Line: ”); scanf(“%d%d%d%d”,&x1,&y1,&x2,&y2); setcolor(6); line(x1,y1,x2,y2); getch(); //cleardevice(); printf(“Enter the angle of rotation: “); scanf(“%f”,&deg); t=(22*deg)/(180*7); b1=abs((x2*cos(t))-(y2*sin(t))); b2=abs((x2*sin(t))+(y2*cos(t))); line(x1,y1,b1,b2); getch(); closegraph(); } OUTPUT