namespace CuriousTabConsoleApplication { struct Sample { public int i; } class MyProgram { static void Main(string[] args) { Sample x = new Sample(); x.i = 10; fun(ref x); Console.Write(x.i + " "); } public static void fun(ref Sample y) { y.i = 20; Console.Write(y.i + " "); } } }
namespace CuriousTabConsoleApplication { class SampleProgram { static void Main(string[] args) { int a = 5; int s = 0, c = 0; Proc(a, ref s, ref c); Console.WriteLine(s + " " + c); } static void Proc(int x, ref int ss, ref int cc) { ss = x * x; cc = x * x * x; } } }
if (age > 18 && no < 11) a = 25;
int i = 10; int j = 10;
int i, j; i = 10 : j = 10;
int i = 10, j = 10;
int i, j = 10;
int i = j = 10;
namespace CuriousTabConsoleApplication { public enum color { red, green, blue }; class SampleProgram { static void Main (string[ ] args) { color c = color.blue; switch (c) { case color.red: Console.WriteLine(color.red); break; case color.green: Console.WriteLine(color.green); break; case color.blue: Console.WriteLine(color.blue); break; } } } }
switch (id) { case 6: grp = "Grp B"; break; case 13: grp = "Grp D"; break; case 1: grp = "Grp A"; break; case ls > 20: grp = "Grp E"; break ; case Else: grp = "Grp F"; break; }
if (age > 18 || no < 11) a = 25;
fun(int i, Single j, double k) decimal
{ ... }
static decimal fun(int i, Single j, double k)
{ ... }
fun(int i, Single j, double k)
{
...
return decimal;
}
static decimal fun(int i, Single j, double k) decimal
{ ... }
if (Condition1)
{// Some statement}
if (Condition1) {// Some statement}
else {// Some statement}
if (Condition1) {// Some statement}
else {// Some statement}
else if ( Condition2){//Some statement}
if ( Condition1 ) {// Some statement}
else if ( Condition2 ) {// Some statement}
else {// Some statement}
if ( Condition1 ) {// Some statement}
else if ( Condition2 ) {// Some statement}
else if ( Condition3 ) {// Some statement}
else {// Some statement}
if (Condition1) {// Some statement}
else {// Some statement}
else if ( Condition2){//Some statement}
using System; namespace CuriousTabConsoleApplication { class MyProgram { static void Main(string[] args) { int index = 6; int val = 44; int[] a = new int[5]; try { a[index] = val ; } catch(IndexOutOfRangeException e) { Console.Write("Index out of bounds "); } Console.Write("Remaining program"); } } }
Comments
There are no comments.Copyright ©CuriousTab. All rights reserved.