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.Collections.ObjectModel; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Management.Automation; | |
using System.Text; | |
using System.Threading; | |
using System.Threading.Tasks; |
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
namespace ChainOfResponsibility | |
{ | |
//Handler class | |
public abstract class Approver | |
{ | |
public abstract void HandleRequest(int requestAmount); | |
protected Approver NextApprover; | |
public void SetNextApprover(Approver approver) | |
{ | |
NextApprover = approver; |
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; | |
namespace DuplicateFileFinder | |
{ | |
public class FileDetails | |
{ | |
public string FileName { get; set; } | |
public string FileHash { get; set; } | |
} | |
} |
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.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace VisitorPattern | |
{ | |
public enum Categories | |
{ |
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.Configuration; | |
using System.Data; | |
using System.Linq; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using System.Windows; | |
namespace WPFSingleInstanceApplication |
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
#export data using Export-CSV cmdlet | |
Get-EventLog Application -Newest 100 | Export-Csv logs.csv | |
Get-Content logs.csv | |
#import CSV data using Import-CSV cmdlet | |
#specify path | |
$path = "C:\PowerShell\logs.csv" | |
#import csv file and specify specific columns you want to import using -Header | |
$file = Import-Csv $path -Delimiter "," | |
#$file |
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.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace StatePattern | |
{ | |
//state | |
public abstract class State |
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; | |
namespace StrategyPattern | |
{ | |
//strategy | |
public interface IPaymentStrategy | |
{ | |
void Pay(double amount); | |
} | |
//concrete strategy |
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; | |
namespace TemplatePattern | |
{ | |
//Template abstract class | |
public abstract class OrderTemplate | |
{ | |
public abstract void SelectProduct(); | |
public abstract void Payment(); | |
public abstract void Deliver(); |
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
#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) |
NewerOlder