• Like

Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Bodlogiin code

  • 2,068 views
Uploaded on

 

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
2,068
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
59
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. namespace ConsoleApplication1<br />{<br /> class Program<br /> {<br /> static void Main(string[] args)<br /> {<br /> RefactorExtractMetod();<br /> RefactorExtractMetod();<br /> Console.ReadLine(); <br /> }<br /> private static void RefactorExtractMetod()<br /> {<br /> Console.Title = " Application" ;<br /> Console.ForegroundColor = ConsoleColor.Yellow;<br /> Console.BackgroundColor = ConsoleColor.Blue;<br /> Console.WriteLine(" ****************************************" );<br /> Console.WriteLine(" *********** Welcome ********************" );<br /> Console.WriteLine(" ****************************************" );<br /> Console.BackgroundColor = ConsoleColor.Black; <br /> }<br /> }<br />}<br />namespace ConsoleApplication3<br />{<br /> class Program<br /> {<br /> public static int Main(string[] args)<br /> {<br /> for (int i = 0; i < args.Length; i++)<br /> Console.WriteLine(" Arg: {0}" , args[i]);<br /> return 0;<br /> <br /> }<br /> }<br />}<br />namespace ConsoleApplication4<br />{<br /> class Program<br /> {<br /> static void Main(string[] args)<br /> {<br /> Console.WriteLine(" C format: {0:C}" , 99989.987);<br /> Console.WriteLine(" D6 format: {0:D6}" , 99999);<br /> Console.WriteLine(" E format: {0:E}" , 99999.76543);<br /> Console.WriteLine(" F3 format: {0:F3}" , 99999.9999);<br /> Console.WriteLine(" N format: {0:N}" , 99999);<br /> Console.WriteLine(" X format: {0:X}" , 99999);<br /> Console.WriteLine(" x format: {0:x}" , 99999);<br /> Console.ReadLine();<br /> }<br /> }<br />}<br />namespace ConsoleApplication5<br />{<br /> class StringFormat<br /> {<br /> static void Main(string[] args)<br /> {<br /> string FormatStr;<br /> FormatStr = String.Format(" Don't you wish you had {0:c} in your account?" , 99989.987);<br /> Console.WriteLine(FormatStr);<br /> Console.ReadLine();<br /> <br /> }<br /> }<br />}<br />namespace ConsoleApplication7<br />{<br /> class Program<br /> {<br /> static void Main(string[] args)<br /> {<br /> string[] books = { " complex algoritm" , " do you remember" , " C and C++" };<br /> foreach (string s in books)<br /> Console.WriteLine(s);<br /> <br /> int[] myints = { 10, 20, 30, 40 };<br /> foreach (int i in myints) <br /> Console.WriteLine(i);<br /> Console.ReadLine();<br /> }<br /> }<br />}<br />namespace ConsoleApplication8<br />{<br /> class Program<br /> {<br /> static void Main(string[] args)<br /> {<br /> string userIsDone = " " ;<br /> do<br /> {<br /> Console.Write(" Are you done? [yes] [no]: " );<br /> userIsDone = Console.ReadLine();<br /> Console.WriteLine(" In while loop" );<br /> } while (userIsDone.ToLower() != " yes" );<br /> }<br /> }<br />}<br />namespace ConsoleApplication9<br />{<br /> class Program<br /> {<br /> static void Main(string[] args)<br /> {<br /> Console.WriteLine(" 1 [C#], 2 [VB]" );<br /> Console.Write(" please pick you language preference: " );<br /> string langChoice = Console.ReadLine();<br /> int n = int.Parse(langChoice);<br /> switch (n)<br /> {<br /> case 1:<br /> Console.WriteLine(" Good choice, C# is a fine language" );<br /> break;<br /> case 2:<br /> Console.WriteLine(" Good choice, VB is a fine language" );<br /> break;<br /> default:<br /> Console.WriteLine(" will .. good luck with that " );<br /> break; <br /> }<br /> Console.ReadLine();<br /> }<br /> }<br />namespace EnmiinJishee<br />{<br /> class Enum1<br /> {<br /> enum EmpType<br /> {<br /> Boss=1,<br /> Manager=2,<br /> Ahlagch=3,<br /> Ajilchin=4,<br /> }<br /> static void Main(string[] args)<br /> {<br /> Array obj = Enum.GetValues(typeof(EmpType));<br /> Console.WriteLine(" This enum has {0} members." , obj.Length);<br /> foreach (EmpType e in obj)<br /> {<br /> Console.Write(" string Name: {0}," , e.ToString());<br /> Console.Write(" int: ({0})," ,Enum.Format(typeof(EmpType),e," D" ));<br /> Console.Write(" hex: ({0}) ," , Enum.Format(typeof(EmpType), e, " X" ));<br /> Console.ReadLine();<br /> }<br /> }<br /> }<br />}<br />namespace ObjectMethods<br />{<br /> class Person<br /> {<br /> public Person(string fname, string lname, string s, byte a)<br /> {<br /> firstname = fname;<br /> lastname = lname;<br /> SSN = s;<br /> age = a;<br /> }<br /> public Person() { }<br /> public string firstname;<br /> public string lastname;<br /> public string SSN;<br /> public byte age;<br /> <br /> static void Main(string[] args)<br /> {<br /> Console.WriteLine(" *******Working with Object*********** " );<br /> Person fred = new Person(" Fred" , " Clark" , " 111 - 11 - 1111" , 20);<br /> Console.WriteLine(" -> Fred.Tostring: {0}" ,fred.ToString());<br /> Console.WriteLine(" -> Fred.GetHashCode: {0}" , fred.GetHashCode());<br /> Console.WriteLine(" -> Fred's base class: {0}" , fred.GetType());<br /> <br /> Person p2 = fred;<br /> Object o = p2;<br /> if (o.Equals(fred) && p2.Equals(o))<br /> Console.WriteLine(" fred, p2,& o are referencing the same object." );<br /> Console.ReadLine(); <br /> <br /> }<br /> }<br />}<br />namespace ObjectMethods<br />{<br /> class Person<br /> {<br /> public override string ToString()<br /> {<br /> StringBuilder sb = new StringBuilder();<br /> <br /> sb.AppendFormat(" FirstName={0}" , this.firstname);<br /> sb.AppendFormat(" LastName={0}" , this.lastname);<br /> sb.AppendFormat(" SSN={0}" , this.SSN);<br /> sb.AppendFormat(" Age={0}" , this.age);<br /> <br /> return sb.ToString();<br /> }<br /> public Person(string fname, string lname, string s, byte a)<br /> {<br /> firstname = fname;<br /> lastname = lname;<br /> SSN = s;<br /> age = a;<br /> }<br /> public string firstname;<br /> public string lastname;<br /> public string SSN;<br /> public byte age;<br /> <br /> static void Main(string[] args)<br /> {<br /> Console.WriteLine(" *******Working with Object*********** " );<br /> Person fred = new Person(" Fred " , " Clark " , " 111 - 11 - 1111 " , 20);<br /> Console.WriteLine(" -> Fred.Tostring: {0}" , fred.ToString());<br /> Console.WriteLine(" -> Fred.GetHashCode: {0}" , fred.GetHashCode());<br /> Console.WriteLine(" -> Fred's base class: {0}" , fred.GetType());<br /> Person p2 = fred;<br /> Object o = p2;<br /> if (o.Equals(fred) && p2.Equals(o))<br /> Console.WriteLine(" fred, p2,& o are referencing the same object." );<br /> Console.ReadLine();<br /> }<br /> }<br />}<br />namespace ConsoleApplication19<br />{<br /> class Program<br /> {<br /> static void Main(string[] args)<br /> {<br /> <br /> string Sdate = " 2010-11-10" ;<br /> DateTime CurrentDate = DateTime.Now;<br /> Console.WriteLine(Convert.ToString(DateTime.Now));<br /> Console.WriteLine(CurrentDate.ToString());<br /> CurrentDate = Convert.ToDateTime(Sdate);<br /> Console.WriteLine(CurrentDate);<br /> }<br /> }<br />}<br />namespace ConsoleApplication28<br />{<br /> class Program<br /> {<br /> static void Main(string[] args)<br /> {<br /> //string sdate = " 2010-02-21" ;<br /> //CurrDate = Convert.ToDateTime(sdate);<br /> <br /> DateTime currdate = DateTime.Now;<br /> Console.WriteLine(" Date D format:" +currdate.ToString(" D" ));<br /> Console.WriteLine(" Date d format:" + currdate.ToString(" d" ));<br /> Console.WriteLine(" Date F format:" + currdate.ToString(" F" ));<br /> Console.WriteLine(" Date f format:" + currdate.ToString(" f" ));<br /> Console.WriteLine(" Date G format:" + currdate.ToString(" G" ));<br /> Console.WriteLine(" Date g format:" + currdate.ToString(" g" ));<br /> Console.WriteLine(" Date T format:" + currdate.ToString(" T" ));<br /> Console.WriteLine(" Date t format:" + currdate.ToString(" t" ));<br /> Console.WriteLine(" Date U format:" + currdate.ToString(" U" ));<br /> Console.WriteLine(" Date u format:" + currdate.ToString(" u" ));<br /> Console.WriteLine(" Date s format:" + currdate.ToString(" s" ));<br /> Console.WriteLine(" Date M format:" + currdate.ToString(" M" ));<br /> Console.WriteLine(" Date m format:" + currdate.ToString(" m" ));<br /> Console.WriteLine(" Date Y format:" + currdate.ToString(" Y" ));<br /> Console.WriteLine(" Date y format:" + currdate.ToString(" y" ));<br /> Console.ReadLine();<br /> }<br /> }<br />}<br />namespace ConsoleApplication20<br />{<br /> class Program<br /> {<br /> static void Main(string[] args)<br /> {<br /> Console.WriteLine(" **********Fun with string**********" );<br /> string s = " Boy, this is taking a long time." ;<br /> Console.WriteLine(" --> s contains 'oy'?: {0}" ,s.Contains(" oy" ));<br /> Console.WriteLine(" --> s contains 'Boy'?: {0}" , s.Contains(" Bey" ));<br /> Console.WriteLine(s.Replace('.','!'));<br /> Console.WriteLine(s.Insert(0, " hey" ));<br /> Console.ReadLine();<br /> }<br /> }<br />}<br />namespace ConsoleApplication21<br />{<br /> class Program<br /> {<br /> static void Main(string[] args)<br /> {<br /> Console.WriteLine(" Everyone loves ' Hello World' " );<br /> Console.WriteLine(" Everyone loves quot; Hello Worldquot; " );<br /> Console.WriteLine(" aC:rogocumenticture " );<br /> Console.WriteLine(" Everyone loves ' Hello World' " );<br /> }<br /> }<br />}<br />