For a laugh

/* Usually data inserted here.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace sample
{
class Program
{
static void Main(string[] args)
{
string[] definitions = new string[20];

// Array covering all the instructed data

definitions[0] = “Used to create objects on the heap and invoke constructors.”;
definitions[1] = “The finally block is useful for cleaning up any resources allocated in the try block.”;
definitions[2] = “The Haep is the section of memory in which reference types are allocated”;
definitions[3] = “The Stack is the section of memory in which Value types are allocated”;
definitions[4] = “Virtual memory is a technique by which the system can swap pieces of memory of the machines hard disk to create an illusion for the CPU that it Has memory”;
definitions[5] = “A value Type is a Microsoft .NET type containing actual data rather than a reference to data stored elsewhere in memory.”;
definitions[6] = “A Reference Type is a variable which holds a refernce(pointer) to data rather than containing the actual data.”;
definitions[7] = “An Arrary is a data structure used to store lists of values.”;
definitions[8] = “The Main() Method is a method required by C# to run both Console and Windows From programs.”;
definitions[9] = “The Switch statement is a control statement that handles multiple selections and enumerations by passing control to one of the case statements within it’s body.”;
definitions[10] = “The Queue Class represents a first-in, first-out colection fo objects”;
definitions[11] = “int.Parse() converts a streing of interger characters into a primitive int data type”;
definitions[12] = “The ToString() Method converts a primitive type or object into a string representation.”;
definitions[13] = “decimal is a primitive type that is used to store currency data.”;
definitions[14] = “A Primitive Type is predefined by the language and is named by a reserved keyword”;
definitions[15] = “The Call Stack refers to the fact that when a method is called, it’s added to the top of the stack. When a method returns to its caller,it’s removed from the stack”;
definitions[16] = “Local Variables are variables that are created in a method or code block for the lifetime of that method or code block. They are not visible to any other part of the program”;
definitions[17] = “[] is referred to as an array subscripts. They are used to create array size and access array members.”;
definitions[18] = “{} are used to encapsulate blocks of code such as methods and conditional statements”;
definitions[19] = ” The Scope of a name (e.g. a variable or method) is the region of a program text within which it is possible to refer to the entity declared by name.”;

int option = 0;

do
{
try
{
Console.WriteLine(“IT Tutor C~ Course E-Learnign Prototype”);
Console.WriteLine(“Select an option”);
Console.WriteLine(“1. New”);
Console.WriteLine(“2. finally”);
Console.WriteLine(“3. Heap”);
Console.WriteLine(“4. Stack”);
Console.WriteLine(“5. Virtual memory”);
Console.WriteLine(“6. Value Type”);
Console.WriteLine(“7. ReferenceType”);
Console.WriteLine(“8. Array”);
Console.WriteLine(“9. main() method”);
Console.WriteLine(“10. Switch”);
Console.WriteLine(“11. Queue Class”);
Console.WriteLine(“12. int.Parse() Method”);
Console.WriteLine(“13. ToString() Method”);
Console.WriteLine(“14. decimal”);
Console.WriteLine(“15. Primitive type”);
Console.WriteLine(“Call Stack”);
Console.WriteLine(“Local Variables”);
Console.WriteLine(“18. []”);
Console.WriteLine(“19. {}”);
Console.WriteLine(“20. Scope”);
Console.WriteLine(“21. Exit”);

option = int.Parse(Console.ReadLine());

if (option < 1 && option > 21)
{
throw new ArgumentOutOfRangeException(“Invalid option Selection.”);
}

if (option == 21)
{
Environment.Exit(0);
}

Console.WriteLine();
Console.WriteLine(definitions[option – 1]);
Console.ReadLine();

}
catch (FormatException fEx)
{
Console.WriteLine(fEx.Message);
Console.ReadLine();
}

catch (ArgumentOutOfRangeException aoorEx)
{
Console.WriteLine(aoorEx.Message);
Console.ReadLine();
}

catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.ReadLine();
}

}
while (option != 21);
}
}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s