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 TesteArgumentos { | |
//immutable field | |
readonly TimeSpan _timeSpan; | |
//constructor chaining | |
public TesteArgumentos(): this(new TimeSpan()){ } | |
//an horrible conditional factory, just for the sake of example | |
public TesteArgumentos(int? hours = null, int? minutes = null, int? seconds = null) { | |
if (hours.HasValue && minutes.HasValue && seconds.HasValue) { |
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
/* Primeiro exemplo */ | |
var anonimo = new { | |
id = 1, | |
name = "utilizando var" | |
}; | |
object anonimo2 = new { | |
id = 2, | |
name = "utilizando object" | |
}; |
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 dados = (from p in db.t0010_bairro | |
where p.t0001_cod_cidade == pCodCidade | |
select (int?)p.t0010_cod_bairro).Max() ?? 1; |
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
@echo off | |
rem Ensure this Node.js and NPM are first in the PATH | |
set PATH=%APPDATA%\npm;%~dp0;%PATH% | |
rem git | |
@set git_install_root=C:\Users\Jone\AppData\Local\GitHub\PortableGit_64179092f39f5dacb60dcab147fb4d04266c0eae | |
@set PATH=%git_install_root%\bin;%git_install_root%\mingw\bin;%git_install_root%\cmd;%PATH% | |
rem Figure out node version and architecture and print it. |
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 Cliente { | |
public int Id { get; set; } | |
public bool IsClienteDiferenciado { get; set; } | |
// outras informações ... omitido para brevidade | |
} | |
public class Venda { | |
public int Id { get;set; } | |
public Cliente Cliente { get; set; } //referencia ao cliente | |
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 Coroutine { | |
public static void BeginExecute(IEnumerable<Promise> enumerable) { | |
MoveNext(enumerable.GetEnumerator()); | |
} | |
static void MoveNext(IEnumerator<Promise> enumerator) { | |
if (enumerator.MoveNext()) { | |
var promise = enumerator.Current; | |
promise.Current = promise.Task(); | |
promise.Current._CallBack = () => MoveNext(enumerator); |
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.IO; | |
using System.Linq; | |
using System.Net; | |
namespace AsyncKonsole | |
{ | |
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
using System; | |
using System.Collections.Generic; | |
namespace Barracuda { | |
public delegate void Routine(Action callback); | |
public static class Coroutine { | |
public static void BeginExecute(this IEnumerable<Routine> enumerable) { | |
var enumerator = enumerable.GetEnumerator(); | |
Action next = null; |
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
static CustomBinding GetBinding() { | |
var customBinding = new CustomBinding(); | |
customBinding.Elements.Add(new BinaryMessageEncodingBindingElement()); | |
customBinding.Elements.Add(new HttpTransportBindingElement()); | |
return customBinding; | |
} | |
static EndpointAddress GetEndPoint() { | |
return new EndpointAddress("http://localhost:1294/Service.svc"); |
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 App() { | |
InitializeComponent(); | |
/* passing a pre-configured (intercepted) windsor container to the IoC wrapper: */ | |
var windsor = new WindsorContainer(); | |
windsor.Register(Component.For<ContainerInterceptor>().LifeStyle.Transient); | |
windsor.Register(Component.For<IContainer>() | |
.UsingFactoryMethod<IContainer>(() => { |