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
<Window x:Class="AsyncAwaitExample.MainWindow" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |
xmlns:local="clr-namespace:AsyncAwaitExample" | |
mc:Ignorable="d" | |
Title="MainWindow" Height="350" Width="525"> | |
<StackPanel> | |
<TextBlock Text="Enter number to sum:" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,50,0,0"/> |
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; | |
using System.Collections.Generic; | |
namespace IteratorPattern | |
{ | |
//Aggregate | |
public abstract class Aggregate | |
{ | |
public abstract Iterator GetIterator(); |
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; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace IteratorPattern | |
{ | |
public class MyCollection : IEnumerable | |
{ |
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; | |
using System.Linq; | |
namespace MediatorPattern | |
{ | |
//Concrete Mediator | |
public class ChatRoom : IChatRoom | |
{ | |
private Dictionary<string, Participant> participants = |
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; | |
using System.Linq; | |
namespace MementoPattern | |
{ | |
//Originator class | |
public class Backup | |
{ | |
public string BackupName { 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.Collections.Generic; | |
namespace ObserverPattern | |
{ | |
//Observer | |
public interface IStockPriceWatcher | |
{ | |
string Name { get; set; } | |
Subject Subject { 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.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace StatePattern | |
{ | |
//state | |
public abstract class State |
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
#select excel file you want to read | |
$file = "C:\PowerShell\MyContacts.xlsx" | |
$sheetName = "Sheet1" | |
#create new excel COM object | |
$excel = New-Object -com Excel.Application | |
#open excel file | |
$wb = $excel.workbooks.open($file) |
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; | |
namespace StrategyPattern | |
{ | |
//strategy | |
public interface IPaymentStrategy | |
{ | |
void Pay(double amount); | |
} | |
//concrete strategy |
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; | |
namespace TemplatePattern | |
{ | |
//Template abstract class | |
public abstract class OrderTemplate | |
{ | |
public abstract void SelectProduct(); | |
public abstract void Payment(); | |
public abstract void Deliver(); |