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
private static void OldBadWay() | |
{ | |
//Warning! This is bad code! Don't use this! | |
SoapExample.LocalLibrary locallib = new SoapExample.LocalLibrary(); | |
remoteSoap.RemoteLibrarySoapClient remoteclient = new remoteSoap.RemoteLibrarySoapClient(); | |
var ssCall = new RemoteSSClient(); | |
Console.Clear(); | |
DateTime start; |
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
private static void RunTest(dynamic service,string name, int num1, int num2, ConsoleColor color) | |
{ | |
Console.ForegroundColor = color; | |
DateTime start = DateTime.UtcNow; | |
Console.WriteLine("{0}: {1} + {2} = ",name, num1, num2); | |
var local = service.AddThis(num1, num2); | |
Console.WriteLine("{0} Answer: {1}",name, local); | |
DateTime end = DateTime.UtcNow; | |
Console.WriteLine("{0} Ticks: {1}",name, GetDiff(start, end)); | |
Console.WriteLine("-----"); |
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
RunTest(locallib, "Local Assembly", 100, 100, ConsoleColor.Green); | |
RunTest(remoteclient, @"SOAP/XML", 100, 100, ConsoleColor.Red); | |
RunTest(ssCall, "Service Stack", 100, 100, ConsoleColor.Cyan); |
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
public class Human | |
{ | |
public string LastName { get; set; } | |
public string FirstName { get; set; } | |
public string BirthDay { get; set; } | |
public Int16 HeightInInches { get; set; } | |
public override string ToString() | |
{ | |
return string.Format("{0}, {1} is {2} inches tall. Born on {3}", this.LastName, this.FirstName, this.HeightInInches, this.BirthDay); | |
} |
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
List<Person> persons = PersonGenerator.Get(); | |
var humans= new List<Human>(); | |
humans = persons.ConvertAll(p => new Human | |
{ | |
FirstName = p.Name.Split(' ').FirstOrDefault() | |
, LastName = p.Name.Split(' ').LastOrDefault() | |
, BirthDay = p.DOB.ToShortDateString() | |
, HeightInInches = (short)((Double)p.HeightInCM * 0.393701) | |
}); |
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
public static dynamic PeopleConverter(dynamic sourceobject) | |
{ | |
if (sourceobject.GetType().Name=="Person") | |
{ | |
return ConvertFromPersonToHuman(sourceobject); | |
} | |
if (sourceobject.GetType().Name =="Human") | |
{ | |
return ConvertFromHumanToPerson(sourceobject); | |
} |
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
package main | |
import ( | |
"fmt" | |
sfb "simplefizzbuzz" | |
) | |
func main() { | |
for i := 0; i < 100; i++ { | |
fmt.Printf("\n%v",sfb.GetFizzBuzzResult(i)) |
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
package main | |
import ( | |
"fmt" | |
sfb "fizzbuzzgo/fizzbuzzlib" | |
) | |
func main() { | |
fbp := sfb.FizzBuzzProcessor{GetItems()} |
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
package fizzbuzz | |
import( | |
"strconv" | |
) | |
type FizzBuzzProcessor struct{ | |
Items | |
} |
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
package fizzbuzz | |
import( | |
"strconv" | |
) | |
type FizzBuzzDivisor struct{ | |
Value int //Value to be tested. | |
Message string //Message if a condition is met. | |
} | |
func (fbd FizzBuzzDivisor) GetResult(num int) string { |
OlderNewer