BCA / B.Tech 10 min read

Classes of .NET With C# in Hindi

Classes in .NET with C# in Hindi | .NET में Class क्या है? 


Introduction Classes : Introduction Classes का उपयोग प्रोग्रामिंग में बेसिक अवधारणाओं को समझाने के लिए किया जाता है। उदाहरण के लिए, यदि आप .NET और C# में क्लास की संरचना समझना चाहते हैं, तो यह प्रारंभिक कोड हो सकता है।

कोड:

using System;

class Introduction
{
    public void DisplayMessage()
    {
        Console.WriteLine("नमस्ते! यह Introduction Class का उदाहरण है।");
    }
}

class Program
{
    static void Main(string[] args)
    {
        Introduction intro = new Introduction();
        intro.DisplayMessage();
    }
}

विवरण:

  • Introduction Class में एक मेथड DisplayMessage() है, जो एक संदेश दिखाता है।
  • Main() Method में Introduction क्लास का ऑब्जेक्ट बनाकर मेथड को कॉल किया गया है।
 Class of Addition : यह क्लास दो नंबरों का योग (addition) निकालने के लिए बनाई गई है।

कोड:

using System;

class Addition
{
    public int Add(int a, int b)
    {
        return a + b;
    }
}

class Program
{
    static void Main(string[] args)
    {
        Addition addition = new Addition();
        Console.WriteLine("दो नंबरों का योग: " + addition.Add(10, 20));
    }
}

विवरण:

  • Add(int a, int b) मेथड दो इनपुट लेता है और उनका योग निकालता है।
  • इसे प्रोग्राम के मुख्य हिस्से में कॉल किया गया है।

Class of Factorial : Factorial निकालने के लिए यह क्लास उपयोगी है। Factorial का अर्थ है: n! = n * (n-1) * (n-2) ... * 1

कोड:

using System;

class Factorial
{
    public int CalculateFactorial(int n)
    {
        int fact = 1;
        for (int i = 1; i <= n; i++)
        {
            fact *= i;
        }
        return fact;
    }
}

class Program
{
    static void Main(string[] args)
    {
        Factorial factorial = new Factorial();
        Console.WriteLine("Factorial of 5: " + factorial.CalculateFactorial(5));
    }
}

विवरण:

  • CalculateFactorial(int n) मेथड एक नंबर का फैक्टोरियल निकालता है।
  • For Loop का उपयोग करके परिणाम प्राप्त किया गया है।

Radio Class : यह क्लास रेडियो के वॉल्यूम और चैनल को कंट्रोल करने के लिए है।

कोड:

using System;

class Radio
{
    public int Volume { get; set; }
    public string Channel { get; set; }

    public void Play()
    {
        Console.WriteLine($"Playing Channel: {Channel} at Volume: {Volume}");
    }
}

class Program
{
    static void Main(string[] args)
    {
        Radio radio = new Radio();
        radio.Channel = "FM 101";
        radio.Volume = 5;
        radio.Play();
    }
}

विवरण:
  • Volume और Channel प्रॉपर्टीज के माध्यम से डेटा सेट किया जाता है।
  • Play() मेथड रेडियो की जानकारी दिखाता है।

Alarm Class: यह क्लास अलार्म सेट करने के लिए है।

कोड:

using System;

class Alarm
{
    public string Time { get; set; }

    public void SetAlarm(string time)
    {
        Time = time;
        Console.WriteLine($"अलार्म सेट किया गया है: {Time}");
    }
}

class Program
{
    static void Main(string[] args)
    {
        Alarm alarm = new Alarm();
        alarm.SetAlarm("7:00 AM");
    }
}

विवरण:

  • SetAlarm(string time) मेथड अलार्म के समय को सेट करता है।
  • उपयोगकर्ता समय को सेट कर सकते हैं और अलार्म की पुष्टि कर सकते हैं।

In this Chapter

Classes of .NET With C# in Hindi
Introduction of .Net in Hindi
Web Services in Hindi | वेब सर्विसेस हिंदी में
WSDL in Hindi | WSDL हिंदी में
Boxing & Unboxing in ADO.NET in Hindi
CLR in Hindi | CLR क्या है?
Common Types System in Hindi
MSIL in Hindi
Assemblies & Class Libraries in Hindi
Project of .Net in Hindi
What is VB.NET and IDE in Hindi | वीबी.नेट क्या है ?
Intermediate Language in Hindi
Object Orientation in Hindi
Managed Execution in Hindi
Rapid Development in Hindi
Windows Presentation Foundation in Hindi
Whats new For .NET framework 3.5?
Windows Workflow Foundation (WWF) in Hindi
Windows Card Space in Hindi
Windows Communication Foundation in Hindi
How To Install and Use The Visual Studio 2008
How to Working With Visual Studio 2008
Types of Visual Studio 2008 in Hindi
Visual Studio 2008 IDE in Hindi
How To Create Console Application in Hindi
Introduction of C# in .NET in Hindi
Properties of .NET With C# in Hindi
Structs in C# .NET in Hindi
Delegates & Events in Hindi
Generic Collections in .NET (C#) in Hindi
Type Safety in Hindi
Nullable Types in .NET in Hindi
ADO.NET in Hindi | ADO.NET क्या है?
SQL Connection Object in Hindi
SQL Command in Hindi
LINQ in Hindi | LINQ क्या है?
What is Using Stored Procedures?
Windows Application in .NET in Hindi | Windows Application क्या है?
BCA || .NET with C# 2023 Paper | MDSU Exam Paper
.NET with C# All Important Questions and Answers in Hindi (MDSU)
BCA || .NET with C# 2025 Paper | MDSU Exam Paper