This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| string day = Console.ReadLine(); | |
| switch (day) | |
| { | |
| case "sunday": | |
| Console.WriteLine("today is sunday"); | |
| break; | |
| case "monday": | |
| Console.WriteLine("today is monday"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| string name = "soheil"; | |
| string familyName = "moonesi"; | |
| Console.WriteLine("name : {0} , familyName: {1}", name, familyName); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for (int i = 0,j=10; i < 10 && j>5 ; i++ , j--) | |
| { | |
| Console.WriteLine($"{i} and {j}"); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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}"); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Console.WriteLine("soheil \t moonesi"); | |
| soheil moonesi | |
| Console.WriteLine("soheil \n moonesi"); | |
| soheil | |
| moonesi | |
| Console.WriteLine("soheil \v moonesi"); | |
| soheil | |
| moonesi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for(int i = 0; i < 50; i++) | |
| { | |
| if(i % 7 == 0) | |
| { | |
| Console.WriteLine(i); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Program | |
| { | |
| static void Main() | |
| { | |
| MathHelperExe(); | |
| } | |
| public static class MathHelper | |
| { | |
| public static int Add(int a, int b) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Program | |
| { | |
| static void Main() | |
| { | |
| MathHelperNonStatic mathHelper = new MathHelperNonStatic(); | |
| int result = mathHelper.Add(1, 2); | |
| Console.WriteLine(result); | |
| } | |
| public class MathHelperNonStatic |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace virgol | |
| { | |
| class Program | |
| { | |
| static void Main() | |
| { | |
| UserMsg.sayGoodMorning(); | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Without inheritance | |
| public class SavingsAccount | |
| { | |
| private double balance; | |
| public double GetBalance() | |
| { | |
| return this.balance; | |
| } | |
| } |
OlderNewer