Skip to main content

C# Tutorial, Step-7, General Structure of a C# program

Hello, welcome to All. My name is Abdul Yesdani. Today we are learning about C# program structure. We will discuss about how the program skeleton is made of, what are the different components are in the program.

C# programs can have one or more files. Each file can contain no or plenty of namespaces. A namespace can contain types such as classes, structs, interfaces, enumerations, and delegates, in addition to other namespaces. According to the program needs we can add any of above mentioned types to the project.


The following is the skeleton of a C# program that contains all of these elements. No need to have all of these elements in the program, here all possible elements mentioned. 


// A skeleton of a C# program
using System;
namespace YourNamespace
{
    class YourMainClass
    {
            static void Main(string[] args)
            {
                //Your program starts here...
            }
       }
   class YourClass
    {
    }


    struct YourStruct
    {
    }


      interface IYourInterface
        {
        }


    delegate int YourDelegate();


    enum YourEnum
    {
    }


    namespace YourNestedNamespace
    {
        struct YourStruct
            {
            }
    }
}

using System means , we are using System namespace which contains all the types required to complete a console application.



                                                                        *******


Comments

Popular posts from this blog

Building a Responsive Weather App with React

 Fetching and Displaying Weather Data      By - ABDUL YESDANI Objective:  This document will help you prepare for the workshop on building a responsive weather app using React. You will learn the basics of React, how to use APIs, and how to work with data fetched from an API. By the end of the workshop, you’ll build a simple weather app that fetches real-time weather data.  1. What is React? React is a JavaScript library used to build user interfaces, especially for single-page applications. It lets you create components, which are reusable, isolated pieces of code that define a part of your user interface. Key Terms Component : Think of components as building blocks for your app. Each part of your app’s UI can be a component, like a button, form, or navigation bar. JSX : A syntax extension for JavaScript, which looks a lot like HTML. JSX is used to describe what the UI should look like. State : Data that controls what gets rendered on the screen. State ca...

node.js tutorial

node.js is a open source server environment. Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js is free,it is cross platform means runs on various platforms (Windows, Linux, Unix, Mac). Node.js uses JavaScript on the server.

.Net Presentation

.NET is a free, cross-platform, open source developer platform for building many different types of applications. With .NET, you can use multiple languages, editors, and libraries to build for web, mobile, desktop, games, and IoT. You can write .NET apps in C#, F#, or Visual Basic. C# is a simple, modern, object-oriented, and type-safe programming language. F# is a programming language that makes it easy to write succinct, robust, and performant code. Visual Basic is an approachable language with a simple syntax for building type-safe, object-oriented apps. You can write .NET apps in C#, F#, or Visual Basic. C# is a simple, modern, object-oriented, and type-safe programming language. F# is a programming language that makes it easy to write succinct, robust, and performant code. Visual Basic is an approachable language with a simple syntax for building type-safe, object-oriented apps.