This file contains 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
interface RunMethod { void Go(); } | |
class Car : RunMethod | |
{ | |
public void Go() | |
{ | |
Console.WriteLine("I'm driving"); | |
} | |
} | |
class Helicopter : RunMethod | |
{ |
This file contains 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
class Vehicle | |
{ | |
public void Go() | |
{ | |
Console.WriteLine("I'm driving"); | |
} | |
} | |
class Car : Vehicle {} | |
class Helicopter : Vehicle {} |
This file contains 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
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Me me = new Me(); | |
me.viewGirl(); | |
Console.ReadLine(); | |
} | |
} |
This file contains 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
class Me | |
{ | |
public void viewGirl() | |
{ | |
GirlFactory girlFactory = new GirlFactory(); | |
girlFactory.checkGirl("Vietnam"); | |
girlFactory.checkGirl("Japan"); | |
girlFactory.checkGirl("China"); | |
} | |
} |
This file contains 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
class GirlFactory | |
{ | |
public void checkGirl(String national) | |
{ | |
Girl girl; | |
if(national.Equals("Vietnam")) | |
{ | |
girl = new Vietnamese(); | |
girl.check(); | |
} |
This file contains 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
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Me me = new Me(); | |
me.viewVietnamGirl(); | |
me.viewChinaGirl(); | |
me.viewJapanGirl(); | |
Console.ReadLine(); | |
} |
This file contains 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
class Me | |
{ | |
public void viewVietnamGirl() | |
{ | |
Vietnamese v = new Vietnamese(); | |
v.check(); | |
} | |
public void viewChinaGirl() | |
{ |
This file contains 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
public interface Girl | |
{ | |
void check(); | |
} | |
class Vietnamese : Girl | |
{ | |
public void check() | |
{ | |
Console.WriteLine("Girl from Vietnam"); | |
} |
This file contains 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; | |
using System.Data.Entity; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace linq_ORM_entities | |
{ | |
public static class CustomExtentions |
This file contains 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
public static class ConsoleExtension | |
{ | |
public static void ToConsole<T>(this IEnumerable<T> s, string header) | |
{ | |
Console.WriteLine($"*********BEGIN {header}**************"); | |
foreach (T item in s) | |
{ | |
Console.WriteLine(item); | |
} | |
Console.WriteLine($"*********END {header}**************"); |