Format:
Recent snippets for: Mike Minutillo
Action callMe = () => { };
Action fooledYou = () => callMe();
callMe = fooledYou;
fooledYou();
64 Views
no comments
public abstract class Agent : IAgent { private IDeck _deck; private int _lastAttackedInTick = 0; private IAgentUpdateInfo _currentState; //private object _attackLock = new object(); public INodeInformation CurrentNode { get { return _currentState.Node; } } protected bool AttackedThisTick { get { return _deck.TickNumber == _lastAttackedInTick; } }
113 Views
1 comments
public static class ActionExtensions { public static void ExecuteWith(this Action action, params Action<Action>[] wrappers) { wrappers.Reverse().Aggregate(action, (a, b) => () => b(a)).Invoke(); } } public static class Wrap {
203 Views
no comments
public static class ActionExtensions { public static void ExecuteWithLoggedErrors(this Action action) { try { action(); } catch (Exception ex) {
187 Views
1 comments
public static class GenericExtensions { public static TProp Get<TSource, TProp>(this TSource target, Func<TSource, TProp> getter, TProp ifNull = default(TProp)) where TSource : class { return target == null ? ifNull : getter(target); } } // Usage customer.Get(x => x.Supplier).Get(x => x.Manager).Get(x => x.FullName, "No Manager");
155 Views
2 comments
// Main.cs static void Main(string[] args) { var foo = new Foo(); foo.location = new Point(5, 5); } // Main.il
86 Views
no comments
class DeferredResolutionExtension : UnityContainerExtension { protected override void Initialize() { Context.Policies.Set<IBuildPlanPolicy>(new DeferredBuilderPolicy(), new NamedTypeBuildKey(typeof(Func<>), null)); Context.Policies.Set<IBuildPlanPolicy>(new LazyBuilderPolicy(), new NamedTypeBuildKey(typeof(Lazy<>))); } } class LazyBuilderPolicy : IBuildPlanPolicy
291 Views
no comments
Mapper.CreateMap<Customer, CustomerDto>()
.For(d => d.FirstName, o => o.MapFrom(c => c.FirstName))
.For(d => d.LastName, o => o.MapFrom(c => c.LastName))
.For(d => d.Gender, o => o.MapFrom(c => c.Gender))
.For(d => d.Salutation, o => o.MapFrom(c => c.Salutation))
.For(d => d.PostalAddressLine1, o => o.MapFrom(c => c.PostalAddressLine1))
.For(d => d.PostalAddressLine2, o => o.MapFrom(c => c.PostalAddressLine2))
.For(d => d.PostalAddressLine3, o => o.MapFrom(c => c.PostalAddressLine3))
.For(d => d.PostalAddressPostcode, o => o.MapFrom(c => c.PostalAddressPostcode))
.For(d => d.PostalAddressSuburb, o => o.MapFrom(c => c.PostalAddressSuburb))
183 Views
no comments
class HAL : IInsaneComputer { public IList<Questions> Disconnect(DisconnectionRequest request) { var questions = request.Questions ?? new List<Question>(); var whatAreYouDoing = questions.Ask<WhatAreYouDoing>(GetCurrentUser()); if( whatAreYouDoing.IsUnanswered ) return questions;
122 Views
no comments
public IList<Question> DoSomething(DoSomethingRequest request) { var questions = request.Questions ?? new List<Question>(); var sendNotificationEmail = questions.Ask<CanSendNotifactionEmail>(); if( sendNotifactionEmail.GotResponse(true) ) { delayedActions.Add(() => notificatiosService.SendNotifications()); }
151 Views
1 comments
[DataContract] public class UserBooleanDecision { [DataMember] public bool? Decision { get; set; } [DataMember] public bool RequiresAnswer { get; set; } }
117 Views
no comments
public class SomeController { private static SomeController instance; public SomeController(){} /// <summary> /// Gets the instance. /// </summary> /// <returns></returns> public static SomeController GetInstance()
159 Views
1 comments
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search
