This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
/* //Abstract Classes// | |
* | |
* An abstract class is incomplete and CANNOT be instantiated | |
* | |
* An abstract class CAN ONLY be used as a base class | |
* | |
* An abstract class CANNOT be sealed | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Dynamic; | |
/* Basic Inheritance | |
* | |
* C# Supports only single class inheritance | |
* Multi-level class inheritance is possible | |
* C# supports multiple interface inheritance | |
* The Child class is a specialization of the base class | |
* Base classes are automatically instantiated before the derived classes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
/* //Differences between Classes and Stucts// | |
* | |
* A Struct is a VALUE TYPE -- it is stored on the stack | |
* | |
* A Class is a REFERENCE TYPE -- it is stored on the heap | |
* | |
* VALUE TYPES hold their value in memory where they are declared | |
* REFERENCE TYPES hold a reference to an object in memory |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.WriteLine("Simple File Copy\n"); | |
Console.WriteLine("Any files that have been modified in source directory within last 24 hours will be backed up.\n"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Runtime.CompilerServices; | |
using System.Runtime.Serialization; | |
/* Custom Exception Notes | |
* | |
* End the custom exception class name with 'Exception'. All .NET exceptions end with the 'Exception' suffix. eg. UserAlreadyLoggedInException | |
* | |
* If you want to provide the capability to use innerExceptions, you must overload the constructor as seen below. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
/* //Default and Explicit Interface Implementation// | |
* | |
* If you want to make one of the interface methods act as default -- then implement that method normally, and the other interface explicitly. | |
* + This will make the default method able to be accessed through a class instance | |
* | |
*/ | |
interface I1 //default interface method implement implicitly |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
/* Basic Delegate Notes | |
* | |
* A delegate is a type safe function pointer. It holds a reference(pointer) to a function | |
* | |
* A delegate must have a return type | |
* | |
* The signature of the delegate MUST match the signature of the function that the delegate points to | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
//the goal for this Employee class is NO HARD CODED LOGIC, we can accomplish this using delegates | |
public class Employee | |
{ | |
public int ID { get; set; } | |
public string Name { get; set; } | |
public int CurrentSalary { get; set; } | |
public int YearsExperience { get; set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
//This program will read from a .txt file | |
/* Exception Handling Basics | |
* | |
* An exception is actually a class that derives from the System.Exception class. | |
* The System.Exception class provides valuable information about the exception. | |
* example: Message: Gets a message that describes the current exception |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
/* Exception Handling abuse | |
* | |
* Using exception handling to implement program logical flow is _bad_ and is termed as exception handling abuse | |
* | |
* Below are 2 examples, the first, is an example of Exception Handling Abuse | |
* the second, is an example of properly handling exceptions | |
* | |
*/ |
OlderNewer