You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
651 B
C#
35 lines
651 B
C#
5 years ago
|
/*
|
||
|
* C# Program to Implement Static Method
|
||
|
*/
|
||
|
using System;
|
||
|
class Program
|
||
|
{
|
||
|
static void stamethod()
|
||
|
{
|
||
|
Console.WriteLine("Static Method");
|
||
|
}
|
||
|
void MethodB()
|
||
|
{
|
||
|
Console.WriteLine("Instance Method");
|
||
|
}
|
||
|
static char stamethod2()
|
||
|
{
|
||
|
Console.WriteLine("Static Method");
|
||
|
return 'C';
|
||
|
}
|
||
|
static void Main()
|
||
|
{
|
||
|
Program.stamethod();
|
||
|
Console.WriteLine(Program.stamethod2());
|
||
|
Program programInstance = new Program();
|
||
|
programInstance.MethodB();
|
||
|
Console.Read();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
|
||
|
Static Method
|
||
|
Static Method
|
||
|
C
|
||
|
Instance Method
|