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 LazyLoad<T> | |
{ | |
private readonly Lazy<T> _lazy; | |
private T _value; | |
public LazyLoad(Func<T> valueFactory) | |
{ | |
_lazy = new Lazy<T>(valueFactory); | |
} |
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
#!/bin/bash | |
apt-get install -y curl unzip | |
mkdir -p /var/lib/consul | |
mkdir -p /usr/share/consul | |
mkdir -p /etc/consul/conf.d | |
curl -OL https://releases.hashicorp.com/consul/0.7.5/consul_0.7.5_linux_amd64.zip | |
unzip consul_0.7.5_linux_amd64.zip | |
mv consul /usr/local/bin/consul |
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 ConsoleApplication | |
{ | |
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
Two the_two = new Two(); | |
// 协变 逆变 |
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.Threading; | |
using System.Threading.Tasks; | |
namespace ConsoleApplication | |
{ | |
public 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
// define round | |
function round(float,precision) { | |
return Math.round(float/precision)/(1/precision); | |
} | |
// how to use | |
round(0.3-0.2, .001) |
NewerOlder