Sobre nós Artigos Blog Multimídia Biblioteca Eventos Loja Virtual Contato
Pelo direito de dirigir alcoolizado por Lew Rockwell, terça-feira, 24 de junho de 2008
Sobre nós Artigos Blog Multimídia Biblioteca Eventos Loja Virtual Contato
Pelo direito de dirigir alcoolizado por Lew Rockwell, terça-feira, 24 de junho de 2008
public static IEnumerable<IList<T>> BatchAggregate<T>(this IEnumerable<T> source, int batchSize) | |
{ | |
for (int page = 0; page < source.Count(); page = page + batchSize) | |
{ | |
var list = source | |
.Skip(page) | |
.Take(batchSize) | |
.ToList(); | |
yield return list; |
public IEnumerable<Token> Scan(IEnumerable<char> source) | |
{ | |
var currentState = StatesTable.InitialStage; | |
var currentValue = ""; | |
Func<Token> markPartialStop = () => | |
{ | |
if (currentState.IsStop) | |
{ | |
var result = new Token(currentState.ResultingTokenId, currentValue); |
public static class TypeExtensions | |
{ | |
public static Type GetValueTypeIfNullable(this Type type) | |
{ | |
return (type.IsGenericType && typeof(Nullable<>) == type.GetGenericTypeDefinition()) | |
? type.GetGenericArguments()[0] : type; | |
} | |
} | |
public static class StringExtensions |
[Test] | |
public static void Class_AllStaticMethodsShouldBeDecoratedWithDebuggerStepThroughAttribute() | |
{ | |
var methods = StaticMethodsWithout(typeof(Mooble.Util.StringExtensions), typeof(DebuggerStepThroughAttribute)) | |
methods.Count.Should.Be(0); | |
} | |
IEnumerable<MethodInfo> StaticMethodsWithout(Type type, Type attribute) | |
{ | |
return from m in type.GetMethods() |
public struct MyEnum | |
{ | |
public static readonly MyEnum Value1 = new MyEnum("value1"); | |
public static readonly MyEnum Value2 = new MyEnum("value2"); | |
readonly string name; | |
MyEnum(string name) : this() | |
{ | |
this.name = name; |
var intForm = Type.GetType("ModuloControle.IMessageForm'1").MakeGenericType(myDesiredType) | |
GetType().Assembly.GetTypes() | |
.Where(x=>!x.IsAbstract && typeof(Form).IsAssignableFrom(x) && intForm.IsAssignableFrom(x)) | |
.Select(x => (Form)Activator.CreateInstance(x)); | |
public class MeuDependencyResolver : IDependencyResolver | |
{ | |
private ILookup<Type, object> lookup; | |
public MeuDependencyResolver() | |
{ | |
var dependencias = new [] | |
{ | |
new DummyDependencia1(), new DummyDependencia2(), new DummyDependencia2_2() | |
}; |
public class MeuDependencyResolver : IDependencyResolver | |
{ | |
private ILookup<Type, object> dependencias; | |
public MeuDependencyResolver() | |
{ | |
this.dependencias = Dependencias().ToLookup(x => x.GetType()); | |
} | |
private IEnumerable<object> Depencencias() |
Felipe: | |
quer minha opinião? | |
Rodrigo Vidal: | |
sim :D | |
Felipe: | |
na grande maioria dos casos, tanto faz | |
não terá diferença | |
em casos que um FileSystem é um problema, o DB será um problema também | |
e vice-cersa | |
vice-versa |