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 LoggingFactory | |
{ | |
static LoggingFactory() | |
{ | |
var name = Assembly.GetEntryAssembly().GetName().Name; | |
var fileTarget = new FileTarget{FileName = string.Format("${{basedir}}/{0}_${{logger}}.log", name),Layout = "${message}"}; | |
var fileRule = new LoggingRule("*", LogLevel.Debug, fileTarget); | |
var config = new LoggingConfiguration(); |
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.Net; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace ClientConsole | |
{ | |
static class Program | |
{ |
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) | |
{ | |
var person = Substitute.For<Person>(); | |
person.Name = "sdsdf"; | |
Console.WriteLine(person.Name); | |
} | |
} |
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
[TestFixture] | |
public class ResiliencyTests | |
{ | |
[Test] | |
public void Foo() | |
{ | |
using (var disabledItems = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Office\14.0\Outlook\Resiliency\DisabledItems")) | |
{ | |
foreach (var valueName in disabledItems.GetValueNames()) | |
{ |
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 class Class1 :INotifyPropertyChanged | |
{ | |
public bool IsExistingProject { get; set; } | |
public bool CanSaveProject{get { return !IsExistingProject; }} | |
public event PropertyChangedEventHandler PropertyChanged; | |
} |
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 FormatterExtensions | |
{ | |
public static Response AsUnSafeFile(this IResponseFormatter formatter, string filePath, Request request) | |
{ | |
if (string.IsNullOrWhiteSpace(filePath)) | |
{ | |
throw new Exception("filePath not defiend"); | |
} |
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
[TestFixture] | |
public class TestStringMethods | |
{ | |
string bar = "Sdfsdf"; | |
int reps = 1000000; | |
string foo = "dsfsd"; | |
[Test] | |
public void Format() |
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
protected override void OnStart(string[] args) | |
{ | |
var ports = new [] { 91, 8091 }; | |
foreach (var port in ports) | |
{ | |
try | |
{ | |
ListenOnThread(port); | |
} | |
catch(Exception exception) |
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
<UsingTask TaskName="NotifyPropertyWeaverMsBuildTask.WeavingTask" AssemblyFile="$(SolutionDir)Tools\NotifyPropertyWeaverMsBuildTask.dll" /> | |
<Target AfterTargets="CopyFilesToOutputDirectory" Name="NotifyPropertyWeaver"> | |
<NotifyPropertyWeaverMsBuildTask.WeavingTask TargetPath="$(TargetPath)"/> | |
<Copy SourceFiles="$(TargetPath)" DestinationFiles="@(IntermediateAssembly)"/> | |
</Target> |
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
var path = @"F:\Code\CecilTest\TargetLibrary\bin\Debug\TargetLibrary.dll"; | |
var moduleDefinition = ModuleDefinition.ReadModule(path); | |
var typeDefinition = moduleDefinition.Types.First(x => x.Name.EndsWith("Class1")); | |
var voidType = Type.GetType("System.Void"); | |
var voidTypeReference = moduleDefinition.Import(voidType); | |
var methodDefinition = new MethodDefinition(".ctor", MethodAttributes.Public, voidTypeReference); | |
typeDefinition.Methods.Add(methodDefinition); | |
moduleDefinition.Write(path); |
OlderNewer