summaryrefslogtreecommitdiff
path: root/lib/utility/AnonymousCommand.cs
blob: 0e110dc6228b86fa8bc2163f394961b499f850d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
using System;
using System.Linq.Expressions;

namespace gorilla.utility
{
    public class AnonymousCommand : Command
    {
        readonly Action action;

        public AnonymousCommand(Expression<Action> action) : this(action.Compile()) {}

        public AnonymousCommand(Action action)
        {
            this.action = action;
        }

        public void run()
        {
            action();
        }
    }
}