C# Starter L01-Intro and Warm-up

1,682 views

Published on

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,682
On SlideShare
0
From Embeds
0
Number of Embeds
361
Actions
Shares
0
Downloads
345
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

C# Starter L01-Intro and Warm-up

  1. 1. Mohammad Shaker mohammadshaker.com C# Programming Course @ZGTRShaker 2011, 2012, 2013, 2014 C# Starter L01 –Intro and Warm-up
  2. 2. Welcome to a new course!
  3. 3. Take a Look on XNA and my other courses @ http://www.slideshare.net/ZGTRZGTRAvailable courses to the date of this slide: C# Starter, C# Advanced, WPF, C++, C++.NET, XNA, OpenGL
  4. 4. So, what’s this course all about?
  5. 5. What’s this course all about? C# and WPF
  6. 6. WPF and Silverlight
  7. 7. WPF and Silverlight
  8. 8. WPF and Silverlight
  9. 9. WPF and Silverlight
  10. 10. Windows 8
  11. 11. WPF Automata Project, VB.NET
  12. 12. My 3rd Year Projects with.NET! WPF RFID System Project, C#
  13. 13. C# and WCF (Windows Communication Foundation)
  14. 14. C# and WCF
  15. 15. C# and WCF
  16. 16. C# and ASP.NET
  17. 17. XNA!
  18. 18. XNA!
  19. 19. XNA! XNA
  20. 20. XNA! XNA Mobile!
  21. 21. This course will enable you to make something as awesome as Ropossum, NEXT, iNversion, etc.
  22. 22. Games I Made with C#: Ropossum, Next, iNversion
  23. 23. Ropossum http://www.mohammadshaker.com/ropossum.html
  24. 24. Ropossumis an authoring tool for procedurally generating playable levels for physics-based games (Cut the Rope as a test case.) It allows the creation of content, editing, and realtimeinteraction with the system to provide immediate feedback on the level design. It’s both for players and designers. Read more at: http://www.mohammadshaker.com/ropossum.html Watch the trailer: https://www.youtube.com/watch?v=0SJykSZ5cm4
  25. 25. NEXT procedurally generated endless puzzle game http://www.mohammadshaker.com/next.html
  26. 26. Programming Languages Ranking Source: http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html-July 2014
  27. 27. “There is no programming language -no matter how structured–that will prevent programmers from making bad programs.” Programming languages (Larry Flon)
  28. 28. “If debugging is the process of removing bugs, then programming must be the process of putting them in.” Programming languages (EdsgerW. Dijkstra)
  29. 29. New Technique!
  30. 30. So, Learn C# or not?
  31. 31. Let’s Go C#ing!
  32. 32. .NET 3.0.NET 3.5.NET 4.0.NET 4.5
  33. 33. Visual Studio 2008201020122013
  34. 34. How is a C++ ?
  35. 35. C# introIt’s a fully OOP language! Everything is an object!
  36. 36. Everything is an object! Object Integer String … Car Meal Enemy
  37. 37. Object Integer String … Car Meal Enemy Everything is an object! InC#.NETeverything(evenyourclasses)willdirectlyinheritfromclassobject.ThisisessentialforMemoryManagementandGarbageCollection.
  38. 38. An Objector a Class?
  39. 39. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } }
  40. 40. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } HiIzZz
  41. 41. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } HiIzZz
  42. 42. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } HiIzZz
  43. 43. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } HiIzZz
  44. 44. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } HiIzZz
  45. 45. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } HiIzZz
  46. 46. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } HiIzZz
  47. 47. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } HiIzZz
  48. 48. usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } HiIzZz namespaceMyNameSpace{ // nested namespacenamespacetutorial{ classmyExample1{ publicstaticvoidmyPrint1() { Console.WriteLine("First Example of calling another namespace member."); } } } // Program start classclassNamespaceCalling{ // Main begins program execution. publicstaticvoidMain() { // Write to consoletutorial.myExample1.myPrint1(); tutorial.myExample2.myPrint2(); } } }
  49. 49. usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } HiIzZz namespaceMyNameSpace{ // nested namespacenamespacetutorial{ classmyExample1{ publicstaticvoidmyPrint1() { Console.WriteLine("First Example of calling another namespace member."); } } } // Program start classclassNamespaceCalling{ // Main begins program execution. publicstaticvoidMain() { // Write to consoletutorial.myExample1.myPrint1(); tutorial.myExample2.myPrint2(); } } } namespacecsharp_station.tutorial{ classmyExample2{ publicstaticvoidmyPrint2() { Console.WriteLine("Second Example of calling another namespace member."); } } }
  50. 50. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } HiIzZz
  51. 51. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } HiIzZz
  52. 52. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } HiIzZz
  53. 53. Variables! •Let’s see what you got! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } HiIzZz
  54. 54. Variables! •Let’s see what you got! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } HiIzZz
  55. 55. Variables! •Let’s see what you got! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } HiIzZz
  56. 56. Variables! •Let’s see what you got! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } HiIzZz
  57. 57. Variables! •Let’s see what you got! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } HiIzZz
  58. 58. Variables! •Let’s see what you got! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } HiIzZz
  59. 59. Variables! •Let’s see what you got! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } HiIzZz
  60. 60. Variables! •Let’s see what you got! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } HiIzZz
  61. 61. Variables! •Let’s see what you got! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } }
  62. 62. Variables! •Let’s see what you got! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } }
  63. 63. Variables! •Let’s see what you got! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } }
  64. 64. Variables! •Let’s see what you got! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } }
  65. 65. Variables! •Let’s see what you got! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } }
  66. 66. Variables! •Let’s see what you got! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } }
  67. 67. Variables! •Let’s see what you got! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } }
  68. 68. Variables! •Let’s see what you got! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } }
  69. 69. Variables! •Let’s see what you got! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } }
  70. 70. Variables! •Let’s see what you got! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } }
  71. 71. usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } Variables! •Let’s see what you got!
  72. 72. usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } Variables! •Let’s see what you got!
  73. 73. usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } Variables! •Let’s see what you got!
  74. 74. usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } Variables! •Let’s see what you got!
  75. 75. Variables! •Let’s see what you got! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } HiIzZz!
  76. 76. Variables! •Let’s see what you got! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } HiIzZz!
  77. 77. Variables! •Let’s see what you got! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } HiIzZz!
  78. 78. Variables! •Let’s see what you got! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } HiIzZz!
  79. 79. Variables! •Let’s see what you got! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } HiIzZz!
  80. 80. Variables! •Let’s see what you got! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } HiIzZz!
  81. 81. Variables! •Let’s see what you got! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } HiIzZz!
  82. 82. Variables! •2 Mains! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } HiIzZz!
  83. 83. Variables! •2 Mains! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine("HiIzZz!"); } } } HiIzZz!
  84. 84. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { strings=Console.ReadLine(); Console.WriteLine(s); } } }
  85. 85. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { strings=Console.ReadLine(); Console.WriteLine(s); } } } Hello out there! Hello out there!
  86. 86. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine(Console.ReadLine()); } } }
  87. 87. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine(Console.ReadLine()); } } } Hi Hi
  88. 88. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine(Console.ReadLine()); } } } Hi Hi
  89. 89. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine(Console.ReadLine()); } } } Hi Hi
  90. 90. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine(Console.ReadLine()); } } } Hi Hi
  91. 91. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine(Console.ReadLine()); } } } Hi Hi
  92. 92. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine(Console.ReadLine()); } } } Hi Hi
  93. 93. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine(Console.ReadLine()); } } } Hi Hi
  94. 94. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine(Console.ReadLine()); } } } Hi Hi
  95. 95. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine(Console.ReadLine()); } } } Hi Hi
  96. 96. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine(Console.ReadLine()); } } } Hi Hi
  97. 97. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Console.WriteLine(Console.ReadLine()); } } } Hi Hi
  98. 98. Variables!
  99. 99. Variables!
  100. 100. Variables!
  101. 101. Variables!
  102. 102. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Doubled1=10; doubled2=10; Console.WriteLine(d1+d2); } } }
  103. 103. Variables! 20 usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Doubled1=10; doubled2=10; Console.WriteLine(d1+d2); } } }
  104. 104. 20 usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Doubled1=10; doubled2=10; Console.WriteLine(d1+d2); } } }
  105. 105. 20 usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Doubled1=10; doubled2=10; Console.WriteLine(d1+d2); } } }
  106. 106. 20 usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Doubled1=10; doubled2=10; Console.WriteLine(d1+d2); } } }
  107. 107. 20 usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Doubled1=10; doubled2=10; Console.WriteLine(d1+d2); } } }
  108. 108. 20 usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Doubled1=10; doubled2=10; Console.WriteLine(d1+d2); } } }
  109. 109. 20 usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { Doubled1=10; doubled2=10; Console.WriteLine(d1+d2); } } }
  110. 110. Variables!
  111. 111. Variables!
  112. 112. Variables!
  113. 113. Variables!
  114. 114. Variables!
  115. 115. Variables!
  116. 116. Variables!
  117. 117. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { doubled1=10; Console.WriteLine("Am number 4! not "+d1); } } }
  118. 118. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { doubled1=10; Console.WriteLine("Am number 4! not "+d1); } } } Am number 4! Not 10
  119. 119. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { doubled1=10; Console.WriteLine("Am number 4! not "+d1); } } } Am number 4! Not 10
  120. 120. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { doubled1=10; Console.WriteLine("Am number 4! not "+d1); } } } Am number 4! Not 10
  121. 121. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { doubled1=10; Console.WriteLine("Am number 4! not "+d1); } } } Am number 4! Not 10
  122. 122. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { doubled1=10; Console.WriteLine("Am number 4! not "+d1); } } } Am number 4! Not 10
  123. 123. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { doubled1=10; Console.WriteLine("Am number 4! not "+d1); } } } Am number 4! Not 10
  124. 124. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { doubled1=10; Console.WriteLine("Am number 4! not "+d1); } } } Am number 4! Not 10
  125. 125. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { doubled1=10; Console.WriteLine("Am number 4! not "+d1); } } } Am number 4! Not 10
  126. 126. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { doubled1=10; Console.WriteLine("Am number 4! not "+d1); } } } Am number 4! Not 10
  127. 127. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { doubled1=10; Console.WriteLine("Am number 4! not "+d1); } } } Am number 4! Not 10
  128. 128. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { doubled1=10; Console.WriteLine("Am number 4! not "+d1); } } } Am number 4! Not 10
  129. 129. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { doubled1=10; Console.WriteLine("Am number 4! not "+d1); } } } Am number 4! Not 10
  130. 130. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { doubled1=10; Console.WriteLine("Am number 4! not "+d1); } } } Am number 4! Not 10
  131. 131. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { doubled1=10; Console.WriteLine("Am number 4! not "+d1); } } } Am number 4! Not 10
  132. 132. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { doubled1=10; Console.WriteLine("Am number 4! not "+d1); } } } Am number 4! Not 10
  133. 133. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { doubled1=10; Console.WriteLine("Am number 4! not "+d1); } } } Am number 4! Not 10
  134. 134. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { doubled1=10; Console.WriteLine("Am number 4! not "+d1); } } } Am number 4! Not 10
  135. 135. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { doubled1=10; Console.WriteLine("Am number 4! not "+d1); } } } Am number 4! Not 10
  136. 136. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { doubled1=10; Console.WriteLine("Am number 4! not "+d1); } } } Am number 4! Not 10
  137. 137. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { doubled1=10; Console.WriteLine("Am number 4! not "+d1); } } } Am number 4! Not 10
  138. 138. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { doubled1=10; Console.WriteLine("Am number 4! not "+d1); } } } Am number 4! Not 10
  139. 139. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { doubled1=10; Console.WriteLine("Am number 4! not "+d1); } } } Am number 4! Not 10
  140. 140. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { doubled1=10; Console.WriteLine("Am number 4! not "+d1.ToString()); } } }
  141. 141. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { doubled1=10; Console.WriteLine("Am number 4! not "+d1.ToString()); } } } Am number 4! Not 10
  142. 142. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { // Write to console/get input Console.Write("What is your name? "); Console.Write("Hello, {0}! ", Console.ReadLine()); Console.WriteLine("Welcome!"); } } }
  143. 143. Variables!
  144. 144. Variables!
  145. 145. Variables! >What is your name?<type a string here> [Enter Key] >Hello, <your string here>!Welcome! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { // Write to console/get input Console.Write("What is your name? "); Console.Write("Hello, {0}! ", Console.ReadLine()); Console.WriteLine("Welcome!"); } } }
  146. 146. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { // Write to console/get input Console.Write("What is your name? "); Console.Write("Hello, {0}, {1}, {0}! ", Console.ReadLine(), "Hi!"); Console.WriteLine("Welcome!"); } } }
  147. 147. Variables!
  148. 148. Variables!
  149. 149. Variables!
  150. 150. Variables!
  151. 151. Variables!
  152. 152. Variables!
  153. 153. Variables!
  154. 154. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { int[] intArr=newint[5]; Console.WriteLine(intArr); } } }
  155. 155. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { int[] intArr=newint[5]; Console.WriteLine(intArr); } } } System.Int32[] Press any key to continue...
  156. 156. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { int[] intArr=newint[5]; Console.WriteLine(intArr); } } } System.Int32[] Press any key to continue...
  157. 157. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { int[] intArr=newint[5]; Console.WriteLine(intArr); } } } System.Int32[] Press any key to continue...
  158. 158. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { int[] intArr=newint[5]; Console.WriteLine(intArr); } } } System.Int32[] Press any key to continue...
  159. 159. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { int[] intArr=newint[5]; Console.WriteLine(intArr); } } }
  160. 160. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { int[] intArr=newint[5]; Console.WriteLine(intArr); } } } System.Int32[] Press any key to continue...
  161. 161. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { int[] intArr=newint[5]; Console.WriteLine(intArr); } } } System.Int32[] Press any key to continue...
  162. 162. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { int[] intArr=newint[5]; Console.WriteLine(intArr); } } } System.Int32[] Press any key to continue...
  163. 163. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { int[] intArr=newint[5]; Console.WriteLine(intArr); } } } System.Int32[] Press any key to continue...
  164. 164. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { int[] intArr=newint[5]; Console.WriteLine(intArr); } } } System.Int32[] Press any key to continue...
  165. 165. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { int[] intArr=newint[5]; Console.WriteLine(intArr); } } } System.Int32[] Press any key to continue...
  166. 166. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { int[] intArr=newint[5]; Console.WriteLine(intArr); } } } System.Int32[] Press any key to continue...
  167. 167. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { int[] intArr=newint[5]; Console.WriteLine(intArr); } } } System.Int32[] Press any key to continue...
  168. 168. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { int[] intArr=newint[5]; Console.WriteLine(intArr); } } } System.Int32[] Press any key to continue...
  169. 169. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { int[] intArr=newint[5]; Console.WriteLine(intArr); } } } System.Int32[] Press any key to continue...
  170. 170. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { int[] intArr=newint[5]; Console.WriteLine(intArr); } } } System.Int32[] Press any key to continue...
  171. 171. Variables! usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { int[] intArr=newint[5]; Console.WriteLine(intArr); } } } System.Int32[] Press any key to continue...
  172. 172. Variables! namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { int[] intArrAllocator=newint[2] {0,1}; int[] intArrTracker; Console.WriteLine("Array"); intArrTracker=intArrAllocator; intArrTracker[0] =1; Console.WriteLine("A[0]= {0}"+Environment.NewLine+"A[1]= {1}", intArrTracker[0], intArrTracker[1]); } } }
  173. 173. Variables! namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { int[] intArrAllocator=newint[2] {0,1}; int[] intArrTracker; Console.WriteLine("Array"); intArrTracker=intArrAllocator; intArrTracker[0] =1; Console.WriteLine("A[0]= {0}"+Environment.NewLine+"A[1]= {1}", intArrTracker[0], intArrTracker[1]); } } } Array A[0]= 1 A[1]= 1 Press any key to continue...
  174. 174. Control Structure
  175. 175. Control Structure •The same as c++’s! •“switch” now must be followed with “break;” with every bodied “case”
  176. 176. Control Structure namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { intmyInt=0; switch(myInt) { case1: case2: case3: Console.WriteLine("Your number is {0}.", myInt); break; default: Console.WriteLine("Your number {0} is not between 1 and 3.", myInt); break; } } } }
  177. 177. Control Structure Your number 0 is not between 1 and 3. namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { intmyInt=0; switch(myInt) { case1: case2: case3: Console.WriteLine("Your number is {0}.", myInt); break; default: Console.WriteLine("Your number {0} is not between 1 and 3.", myInt); break; } } } }
  178. 178. Control Structure Your number 0 is not between 1 and 3. namespaceConsoleAppTest { classProgram { staticvoidMain(string[] args) { intmyInt=0; switch(myInt) { case1: case2: case3: Console.WriteLine("Your number is {0}.", myInt); break; default: Console.WriteLine("Your number {0} is not between 1 and 3.", myInt); break; } } } }
  179. 179. Passing Arguments ref,out
  180. 180. Passing Args usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleTestingApp { classProgram { publicstaticvoidIncrement(refinti) { i+=1; } staticvoidMain(string[] args) { inti=0; Increment(refi); Console.WriteLine(i); } } }
  181. 181. Passing Args usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleTestingApp { classProgram { publicstaticvoidIncrement(refinti) { i+=1; } staticvoidMain(string[] args) { inti=0; Increment(refi); Console.WriteLine(i); } } } 1
  182. 182. Passing Args usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleTestingApp { classProgram { publicstaticvoidIncrement(refinti) { i+=1; } staticvoidMain(string[] args) { inti; Increment(refi); Console.WriteLine(i); } } } Compiler error
  183. 183. Passing Args usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleTestingApp { classProgram { publicstaticvoidIncrement(refinti) { i+=1; } staticvoidMain(string[] args) { inti; Increment(refi); Console.WriteLine(i); } } } Compiler error
  184. 184. Passing Args usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleTestingApp { classProgram { publicstaticvoidIncrement(outinti) { i=1; } staticvoidMain(string[] args) { inti= 0; Increment(outi); Console.WriteLine(i); } } } 1
  185. 185. Passing Args usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleTestingApp { classProgram { publicstaticvoidIncrement(outinti) { i=1; } staticvoidMain(string[] args) { inti; Increment(outi); Console.WriteLine(i); } } } 1
  186. 186. Passing Args usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleTestingApp { classProgram { publicstaticvoidIncrement(outinti) { i+=1; } staticvoidMain(string[] args) { inti; Increment(outi); Console.WriteLine(i); } } }
  187. 187. Passing Args usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleTestingApp { classProgram { publicstaticvoidIncrement(outinti) { i+=1; } staticvoidMain(string[] args) { inti; Increment(outi); Console.WriteLine(i); } } }
  188. 188. Passing Args usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleTestingApp { classProgram { publicstaticvoidIncrement(outinti) { i+=1; } staticvoidMain(string[] args) { inti; Increment(outi); Console.WriteLine(i); } } }
  189. 189. Passing Args usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleTestingApp { classProgram { publicstaticvoidIncrement(outinti) { i+=1; } staticvoidMain(string[] args) { inti; Increment(outi); Console.WriteLine(i); } } }
  190. 190. Passing Args usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleTestingApp { classProgram { publicstaticvoidIncrement(outinti) { i+=1; } staticvoidMain(string[] args) { inti; Increment(outi); Console.WriteLine(i); } } }
  191. 191. Passing Args usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleTestingApp { classProgram { publicstaticvoidIncrement(outinti) { i+=1; } staticvoidMain(string[] args) { inti; Increment(outi); Console.WriteLine(i); } } }
  192. 192. Passing Args usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleTestingApp { classProgram { publicstaticvoidIncrement(outinti) { i+=1; } staticvoidMain(string[] args) { inti= 0; Increment(outi); Console.WriteLine(i); } } }
  193. 193. Passing Args usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleTestingApp { classProgram { publicstaticvoidIncrement(outinti) { i+=1; } staticvoidMain(string[] args) { inti= 0; Increment(outi); Console.WriteLine(i); } } }
  194. 194. Passing Args usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleTestingApp { classProgram { publicstaticvoidIncrement(outinti) { i+=1; } staticvoidMain(string[] args) { inti= 0; Increment(outi); Console.WriteLine(i); } } }
  195. 195. Passing Args usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleTestingApp { classProgram { publicstaticvoidIncrement(outinti) { i+=1; } staticvoidMain(string[] args) { inti= 0; Increment(outi); Console.WriteLine(i); } } }
  196. 196. Passing Args usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleTestingApp { classProgram { publicstaticvoidIncrement(refinti) { i+=1; } staticvoidMain(string[] args) { inti = 0; Increment(refi); Console.WriteLine(i); } } }
  197. 197. Passing Args usingSystem; using System.Collections.Generic; using System.Linq; using System.Text; namespaceConsoleTestingApp { classProgram { publicstaticvoidIncrement(refinti) { i+=1; } staticvoidMain(string[] args) { inti = 0; Increment(refi); Console.WriteLine(i); } } }
  198. 198. Overloading with ref, out class MyClass { public void MyMethod(inti) {i = 10;} public void MyMethod(ref inti) {i = 10;} } class MyClass { public void MyMethod(out inti) {i = 10;} public void MyMethod(ref inti) {i = 10;} }
  199. 199. Overloading with ref, out class MyClass { public void MyMethod(inti) {i = 10;} public void MyMethod(ref inti) {i = 10;} } class MyClass { public void MyMethod(out inti) {i = 10;} public void MyMethod(ref inti) {i = 10;} }
  200. 200. Overloading with ref, out class MyClass { public void MyMethod(inti) {i = 10;} public void MyMethod(ref inti) {i = 10;} } class MyClass { public void MyMethod(out inti) {i = 10;} public void MyMethod(ref inti) {i = 10;} }
  201. 201. params,valuemagical Keywords
  202. 202. paramsmagical Keyword
  203. 203. params magical Keyword publicstaticvoidUseIntParams(paramsint[] list) { for(inti=0; i<list.Length; i++) Console.WriteLine(list[i]); Console.WriteLine(); } publicstaticvoidUseObjParams(paramsobject[] list) { for(inti=0; i<list.Length; i++) Console.WriteLine(list[i]); Console.WriteLine(); } publicstaticvoidMain() { UseIntParams(1, 2, 3); UseObjParams(1, 'a', "test"); int[] myarray=newint[3] { 10, 11, 12}; UseIntParams(myarray); }
  204. 204. params magical Keyword publicstaticvoidUseIntParams(paramsint[] list) { for(inti=0; i<list.Length; i++) Console.WriteLine(list[i]); Console.WriteLine(); } publicstaticvoidUseObjParams(paramsobject[] list) { for(inti=0; i<list.Length; i++) Console.WriteLine(list[i]); Console.WriteLine(); } publicstaticvoidMain() { UseIntParams(1, 2, 3); UseObjParams(1, 'a', "test"); int[] myarray=newint[3] { 10, 11, 12}; UseIntParams(myarray); } 1 2 3 1 a test 10 11 12 Press any key to continue...
  205. 205. params magical Keyword publicstaticvoidUseIntParams(paramsint[] list) { for(inti=0; i<list.Length; i++) Console.WriteLine(list[i]); Console.WriteLine(); } publicstaticvoidUseObjParams(paramsobject[] list) { for(inti=0; i<list.Length; i++) Console.WriteLine(list[i]); Console.WriteLine(); } publicstaticvoidMain() { UseIntParams(1, 2, 3); UseObjParams(1, 'a', "test"); int[] myarray=newint[3] { 10, 11, 12}; UseIntParams(myarray); } 1 2 3 1 a test 10 11 12 Press any key to continue...
  206. 206. params magical Keyword publicstaticvoidUseIntParams(paramsint[] list) { for(inti=0; i<list.Length; i++) Console.WriteLine(list[i]); Console.WriteLine(); } publicstaticvoidUseObjParams(paramsobject[] list) { for(inti=0; i<list.Length; i++) Console.WriteLine(list[i]); Console.WriteLine(); } publicstaticvoidMain() { UseIntParams(1, 2, 3); UseObjParams(1, 'a', "test"); int[] myarray=newint[3] { 10, 11, 12}; UseIntParams(myarray); } 1 2 3 1 a test 10 11 12 Press any key to continue...
  207. 207. valuemagical Keyword(Properties)
  208. 208. value magical Keyword •Properties! –set –get
  209. 209. value magical Keyword namespace ConsoleTestingApp { class Car { private double _weight; public void SetWeight(double weight) { _weight = weight; } public double GetWeight() { return _weight; } } }
  210. 210. value magical Keyword namespace ConsoleTestingApp { class Car { private double _weight; public void SetWeight(double weight) { _weight = weight; } public double GetWeight() { return _weight; } } } namespaceConsoleTestingApp { classCar { privatedouble_weight; publicdoubleWeight { set{_weight =value; } get{ return_weight; } } } }
  211. 211. value magical Keyword namespaceConsoleTestingApp { classCar { privatedoubleweight; publicdoubleWeight { set{ weight=value; } get{ returnweight; } } } }
  212. 212. value magical Keyword namespaceConsoleTestingApp { classCar { privatedoubleweight; publicdoubleWeight { set{ weight=value; } get{ returnweight; } } } }
  213. 213. value magical Keyword namespaceConsoleTestingApp { classCar { privatedoubleweight; publicdoubleWeight { set{ weight=value; } get{ returnweight; } } } }
  214. 214. value magical Keyword namespaceConsoleTestingApp { classCar { privatedouble_weight; publicdoubleWeight { get{ return_weight; } } } } class Program { public static void Main() { Car myCar= new Car(); myCar.Weight= 10; } }
  215. 215. value magical Keyword namespaceConsoleTestingApp { classCar { privatedouble_weight; publicdoubleWeight { get{ return_weight; } } } } class Program { public static void Main() { Car myCar= new Car(); myCar.Weight= 10; } }
  216. 216. value magical Keyword namespaceConsoleTestingApp { classCar { privatedouble_weight; publicdoubleWeight { get{ return_weight; } } } } class Program { public static void Main() { Car myCar= new Car(); myCar.Weight= 10; } }
  217. 217. Auto implemented property usingSystem; publicclassCustomer { public intID { get; set; } public string Name { get; set; } } publicclassAutoImplementedCustomerManager { staticvoidMain() { Customercust=newCustomer(); cust.ID=1; cust.Name="AmelioRosales"; Console.WriteLine( "ID: {0}, Name: {1}", cust.ID, cust.Name); Console.ReadKey(); } }
  218. 218. Code fast and don’t break things A ?? B means A!= null ? A : B
  219. 219. Concepts You Should Know
  220. 220. A Look Inside the MemoryStackand Heap
  221. 221. Stackand Heap •The Stack –is where normal variables are stored (likeints, anddoubles) –All of the variables inside of a method are placed on the stack as well. •The Heap –It is just put in a big pile, hence the "heap" name! –Objects (classes instances) are stored in the heap. •In order to keep track of your object, a "reference" is used and placed on the stack. So the bulk of the object's information lives in the heap, while you get to keep track of a reference to it on the stack.
  222. 222. Boxing and Unboxinglike Java?
  223. 223. Boxing and Unboxing •Boxing: the following assignment wraps up the value 3 into a heap object object obj= 3; •Unboxing: the following assignment unwraps the value again intx = (int) obj; 3 obj
  224. 224. Blocks
  225. 225. Blocks
  226. 226. Blocks
  227. 227. References •Wroxand Microsoft
  228. 228. Keep in touch and let’s connect http://www.mohammadshaker.com mohammadshakergtr@gmail.com https://twitter.com/ZGTRShaker@ZGTRShakerhttps://de.linkedin.com/pub/mohammad-shaker/30/122/128/ http://www.slideshare.net/ZGTRZGTR https://www.goodreads.com/user/show/11193121-mohammad-shaker https://plus.google.com/u/0/+MohammadShaker/ https://www.youtube.com/channel/UCvJUfadMoEaZNWdagdMyCRA http://mohammadshakergtr.wordpress.com/
  229. 229. Hope you enjoy your first class (/object?)! :D

×