Total Page Preview:   000000000018

What is class in c sharp language in English and Hindi

Class in C# Language in English:
In C# language, a class is a blueprint or a template that defines the behavior and properties of an object. It is a user-defined data type that encapsulates data and the methods that operate on that data. A class defines a new type that can be used to create objects.
A class can contain data members, which are variables used to store data, and methods, which are functions that operate on that data. Data members and methods can be public, private, or protected, which determines their accessibility from outside the class.
Here is an example of a simple class in C#:
In this example, we define a class called "Car" with three public data members (Make, Model, and Year) and two public methods (StartEngine and StopEngine). The methods contain code that performs specific actions on the Car object.
To use this class, we can create an instance of it by declaring a variable of type Car and then initializing it using the "new" keyword, like this:
In this example, we create a new Car object called "myCar" and set its Make, Model, and Year properties. We then call the StartEngine method to start the car's engine.
Class in C# Language in Hindi:
C# language mein, ek class ek blueprint ya template hota hai jo ek object ki properties aur behavior define karta hai. Ye ek user-defined data type hota hai jo data ko encapsulate karta hai aur us data ke upar operation karne wale methods ko define karta hai. Ek class naya type define karta hai jise objects create karne ke liye use kiya ja sakta hai.
Ek class data members ko contain kar sakta hai, jo data store karne ke liye variables ka use karte hain, aur methods ko contain kar sakta hai, jo us data ke upar operation karne wale functions hote hain. Data members aur methods public, private, ya protected ho sakte hain, jismein inke accessibility class ke bahar se decide ki jati hai.
Yahan ek example diya gaya hai jo ek simple class ko C# mein define karta hai:
Is example mein, hum ek "Car" class ko define karte hain jismein teen public data members (Make, Model, aur Year) aur do public methods (StartEngine aur StopEngine) hote hain. Methods Car object par specific actions perform karne wale code ko contain karte hain.
Is class ko use karne ke liye, hum ek Car object ko create karte hain jo ek Car type ke variable ko declare karke "new" keyword ka use karke initialize kiya ja sakta hai, jaise ki ye:
Is example mein, hum ek new Car object ko "myCar" naam se create karte hain aur uske Make, Model, aur Year properties set karte hain. Phir hum StartEngine method ko call karte hain jo Car ke engine ko start kar deta hai.

Thank You

About Author

Brijesh Kumar

Database Developer

I have more then 6 years Experience in Microsoft Technologies - SQL Server Database, ETL Azure Cloud - Azure SQL Database, CosmosDB, Azure Data Factory, PowerBI, Web Job, Azure Function, Azure Storage, Web Apps, Powershall and Database Migration On-Premise to Azure Cloud.
LinkedIn :