MovieTimes Console App

[code language=”csharp”] using System; using static System.Console; /// <summary> /// # # # # # # # # # # # # # /// # Mark Hesser # /// # Jan 25, 18 # /// # Movie Running Time # /// # # # # # # # # # # # # # # […]

Chapter 8 Figures – code samples

Ambiguous Methods [code language=”csharp”] using static System.Console; class AmbiguousMethods { static void Main() { int iNum = 20; double dNum = 4.5; SimpleMethod(iNum, dNum); // calls first version SimpleMethod(dNum, iNum); // calls second version SimpleMethod(iNum, iNum); // error! Call is ambiguous. } private static void SimpleMethod(int i, double d) { WriteLine("Method receives int and double"); […]

ParamsArray

[code language=”csharp”] using System; using static System.Console; namespace ParamsArray { class Program { static void Main(string[] args) { double[] array = { 3, 7, 9, 12, 16 }; Average(7); Average(26, 98); Average(41.5, 77.6, 98.2, 41.2); Average(array); } static void Average(params double[] nums) { double total = 0; double avg; foreach (double number in nums) { […]

MemorySwap

[code language=”csharp”] using System; namespace MemorySwap { class Program { static void Main(string[] args) { int first=24, second=45; Console.WriteLine("The value of first is {0} and second is {1}", first, second); Swap(ref first, ref second); Console.WriteLine("The new value of first is {0} and second is {1}", first, second); } static void Swap(ref int one, ref int […]

Hands On Project 4.4

Learn how to recognize the differences among several different routing protocols and their packets as their data is displayed in Wireshark. Description: In this project, you use Wireshark to view sample capture files of different routing protocols for both IPv4 and IPv6. To view RIPv1 routing protocol data: Start Wireshark. (In Windows 7, click the […]