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
| <?xml version="1.0" encoding="utf-8"?> | |
| <CodeSnippet Format="1.0.0" xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> | |
| <Header> | |
| <Title>Rules Property</Title> | |
| <Author>Jonathas Piazzarollo Costa</Author> | |
| <Shortcut>rulesproperty</Shortcut> | |
| <Description>Creates a Rules property.</Description> | |
| <SnippetTypes> | |
| <SnippetType>Expansion</SnippetType> | |
| </SnippetTypes> |
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
| <?xml version="1.0" encoding="utf-8"?> | |
| <CodeSnippet Format="1.0.0" xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> | |
| <Header> | |
| <Title>Stopwatch</Title> | |
| <Author>Jonathas Piazzarollo Costa</Author> | |
| <Shortcut>stopwatch</Shortcut> | |
| <Description>Surrounds code with Stopwatch.</Description> | |
| <SnippetTypes> | |
| <SnippetType>SurroundsWith</SnippetType> | |
| </SnippetTypes> |
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 void CopyProperties(object from, object to) | |
| { | |
| foreach (var p in ((object)from).GetType().GetProperties()) | |
| { | |
| var toProperty = to.GetType().GetProperty(p.Name); | |
| var fromValue = p.GetValue(from, null); | |
| if (toProperty.PropertyType.IsValueType) | |
| { | |
| var convertedValue = Convert.ChangeType(fromValue, toProperty.PropertyType); | |
| toProperty.SetValue(to, convertedValue, null); |
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
| using System; | |
| using System.Data; | |
| using NHibernate; | |
| using NHibernate.SqlTypes; | |
| using NHibernate.UserTypes; | |
| namespace Framework.DataAccess.NHibernate.UserTypes | |
| { | |
| [Serializable] | |
| public class SimNaoType : IUserType |
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
| if (entity.GetType() != typeof(LogAuditoriaEntity) && (entity is AuditableEntity)) | |
| { | |
| try | |
| { | |
| var logAuditoria = new LogAuditoriaEntity | |
| { | |
| NomeTabela = ObterNomeTabela(persister), | |
| TipoOperacao = operacao, | |
| TxtComando = ObterComandoSql(session), | |
| ForeignId = id.ToString() |
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 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++) |
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
| 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 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 Competencia | |
| { | |
| public Competencia(int mes, int ano) | |
| { | |
| try | |
| { | |
| new DateTime(ano, mes, 1); | |
| } | |
| catch (Exception) | |
| { |
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
| 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 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 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()); |