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 TestDaoInstaller : IWindsorInstaller | |
{ | |
public void Install(IWindsorContainer container, IConfigurationStore store) | |
{ | |
container.Register( | |
AllTypes.FromAssemblyNamed("YourProduct.DataAccess") | |
.BasedOn(typeof(IDao<,>)) | |
.Configure(c => c.LifeStyle.Transient) | |
.WithService.Select((t, baseType) => t.GetInterfaces()) | |
.BasedOn(typeof(IDao<>)) |
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 LocalizedModelBinder : DefaultModelBinder | |
{ | |
private readonly CultureInfo _cultureInfo; | |
public LocalizedModelBinder(string cultureName) | |
{ | |
_cultureInfo = CultureInfo.GetCultureInfo(cultureName); | |
} | |
public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) |
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.Linq; | |
using System.Text.RegularExpressions; | |
public static class StringExtensions | |
{ | |
public static string ToUpper(this string name, string separator) | |
{ | |
string upper = Regex | |
.Matches(name, "[A-Z][a-z]+") | |
.Cast<Match>() |
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 TypeExtensions | |
{ | |
public static bool IsNullableOrType<T>(this Type type) | |
where T : struct | |
{ | |
return (type == typeof(T) || type == typeof(T?)); | |
} | |
} |
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 TypeExtensions | |
{ | |
public static bool IsNullableOrType<T>(this Type type) | |
where T : struct | |
{ | |
return (type == typeof(T) || type == typeof(T?)); | |
} | |
} | |
public static class StringExtensions |
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 TypeExtensions | |
{ | |
public static Type GetValueTypeIfNullable(this Type type) | |
{ | |
return type.IsNullable() ? type.GetGenericArguments()[0] : type; | |
} | |
public static bool IsNullable(this Type type) | |
{ | |
return (type.IsGenericType && typeof(Nullable<>) == type.GetGenericTypeDefinition()); |
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.Web.Mvc; | |
using Newtonsoft.Json; | |
namespace ActionResults | |
{ | |
public class ExtStoreResult : ActionResult | |
{ | |
public virtual string StoreName { get; set; } | |
public virtual object StoreData { get; set; } |
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 Competencia | |
{ | |
public Competencia(int mes, int ano) | |
{ | |
try | |
{ | |
new DateTime(ano, mes, 1); | |
} | |
catch (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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace Architecture.StateMachine | |
{ | |
/// <summary> | |
/// Representa uma máquina de estados. | |
/// </summary> | |
/// <typeparam name="T">Tipo do estado.</typeparam> |
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 long Solve() | |
{ | |
var powers = new List<long>(); | |
var numbers = new List<long>(); | |
for (int i = 0; i < 10; i++) | |
powers.Add((long)BigInteger.Pow(i, 5)); | |
for (int a = 0; a < 10; a++) | |
for (int b = 0; b < 10; b++) |
OlderNewer