Wednesday, May 2, 2012

CLASS


Class consist of methods and variables.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        class student
        {
            int rno;
            string name, address;
            public void getdata(int r, string n, string add)
            {
                rno = r;
                name = n;
                address = add;

            }
            public void display()
            {
                Console.WriteLine("ROLL NUMBER: "+rno.ToString());
                Console.WriteLine("Name: " + name);
                Console.WriteLine("Address: " + address);
            }
        }
        static void Main(string[] args)
        {
            student sd = new student();
            Console.WriteLine("enter no,name,address");
            sd.getdata(int.Parse(Console.ReadLine()), Console.ReadLine(), Console.ReadLine());
            sd.display();
            Console.WriteLine("end");
            Console.ReadLine();
        }
    }
}

No comments:

Using Authorization with Swagger in ASP.NET Core

 Create Solution like below LoginModel.cs using System.ComponentModel.DataAnnotations; namespace UsingAuthorizationWithSwagger.Models {     ...