Skip to content

Instantly share code, notes, and snippets.

string day = Console.ReadLine();
switch (day)
{
case "sunday":
Console.WriteLine("today is sunday");
break;
case "monday":
Console.WriteLine("today is monday");
string name = "soheil";
string familyName = "moonesi";
Console.WriteLine("name : {0} , familyName: {1}", name, familyName);
for (int i = 0,j=10; i < 10 && j>5 ; i++ , j--)
{
Console.WriteLine($"{i} and {j}");
}
for (int i = 0,j=10; i < 10 && j>5 ; i++ , j--)
{
if (j == 7)
{
continue;
Console.WriteLine("is it run ?");
}
Console.WriteLine($"{i} and {j}");
}
Console.WriteLine("soheil \t moonesi");
soheil moonesi
Console.WriteLine("soheil \n moonesi");
soheil
moonesi
Console.WriteLine("soheil \v moonesi");
soheil
moonesi
for(int i = 0; i < 50; i++)
{
if(i % 7 == 0)
{
Console.WriteLine(i);
}
}
class Program
{
static void Main()
{
MathHelperExe();
}
public static class MathHelper
{
public static int Add(int a, int b)
class Program
{
static void Main()
{
MathHelperNonStatic mathHelper = new MathHelperNonStatic();
int result = mathHelper.Add(1, 2);
Console.WriteLine(result);
}
public class MathHelperNonStatic
namespace virgol
{
class Program
{
static void Main()
{
UserMsg.sayGoodMorning();
}
}
}
// Without inheritance
public class SavingsAccount
{
private double balance;
public double GetBalance()
{
return this.balance;
}
}