0% found this document useful (0 votes)
14 views

Static Class in c# Code

Uploaded by

Madhuri Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Static Class in c# Code

Uploaded by

Madhuri Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

using System;

using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace STATIC_CLASS
{

static class product


{
public static int ProductId;
public static string ProductName;
public static int ProductPrice;

static product()
{
ProductId = 111;
ProductName = "Guitar";
ProductPrice = 5000;
}

public static void getProductDetails()


{
Console.WriteLine("Product id = {0}", ProductId);
Console.WriteLine("Product Name = {0}", ProductName);
Console.WriteLine("Product Price = {0}", ProductPrice);
}

public static void getDiscount()


{
int d_amount = ProductPrice / 10;
Console.WriteLine("Your discount amount is: {0}",d_amount);
Console.WriteLine("Total cost of product is: {0}",(ProductPrice -
d_amount));
}
}

class Program
{

static void Main(string[] args)


{
product.getProductDetails();
product.getDiscount();
Console.ReadLine();
}
}
}

You might also like