A primitive type is a number, bool, string or void.
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
| <#@ template debug="false" hostspecific="true" language="C#" #> | |
| <#@ assembly name="System.Core" #> | |
| <#@ import namespace="System.Linq" #> | |
| <#@ import namespace="System.Runtime.Remoting.Messaging" #> | |
| <#@ output extension=".Designer.cs" #> | |
| using System.Collections.Generic; | |
| namespace <#=CallContext.GetData("NamespaceHint")#> | |
| { |
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
| [Binding] | |
| public class StepArgumentTransforms | |
| { | |
| static readonly List<string> _positives = "is,can,will,should,does,do,have,correct".Split(',').ToList(); | |
| static readonly List<string> _negatives = "{0}n't,{0}not,{0} not,{0} no,in{0},un{0}".Split(',').SelectMany(s => _positives.Select(word => string.Format(s, word))).ToList(); | |
| [StepArgumentTransformation] | |
| public bool EnglishBool(string s) | |
| { | |
| if (_positives.Contains(s)) |
- A superset of the JavaScript language.
- Code in TypeScript, compile to JavaScript, deploy JavaScript. (Similar workflow to CoffeeScript)
- Very similar to JavaScript.
- Type safety - when you need it. TypeScript is a gradually typed language.
- Less boilerplate.
- Programmer's intent is clearer in the code.
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
| static class EnumDescriptionMapper<T> | |
| { | |
| public static readonly Dictionary<T, string> EnumDescriptions; | |
| public static readonly Dictionary<string, T> DescriptionsValues; | |
| static EnumDescriptionMapper() | |
| { | |
| var values = (T[])Enum.GetValues(typeof(T)); | |
| EnumDescriptions = values.ToDictionary(x => x, GetAttributeDescription); | |
| DescriptionsValues = EnumDescriptions.ToDictionary(x => x.Value, x => x.Key); |
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 Extensions | |
| { | |
| public static TValue GetOrCreate<TKey, TValue>(this Dictionary<TKey, TValue> d, TKey key, Func<TKey, TValue> valueFactory) | |
| { | |
| TValue value; | |
| if (!d.TryGetValue(key, out value)) | |
| { | |
| d[key] = value = valueFactory(key); | |
| } | |
| return value; |
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
| <#@ template debug="true" hostspecific="true" language="C#" #> | |
| <#@ output extension=".d.ts" #> | |
| <# /* Update this line to match your version of SignalR */ #> | |
| <#@ assembly name="$(SolutionDir)\packages\Microsoft.AspNet.SignalR.Core.2.2.0\lib\net45\Microsoft.AspNet.SignalR.Core.dll" #> | |
| <# /* Load the current project's DLL to make sure the DefaultHubManager can find things */ #> | |
| <#@ assembly name="$(TargetPath)" #> | |
| <#@ assembly name="System.Core" #> | |
| <#@ assembly name="System.Web" #> | |
| <#@ assembly name="System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" #> | |
| <#@ assembly name="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" #> |
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 TileCanvas : Canvas | |
| { | |
| public static readonly DependencyProperty ImageSourceProperty = DependencyProperty.Register("ImageSource", typeof(ImageSource), typeof(TileCanvas), new UIPropertyMetadata(null, OnImageSourceChanged)); | |
| private static void OnImageSourceChanged(DependencyObject o, DependencyPropertyChangedEventArgs args) | |
| { | |
| ((TileCanvas)o).Rebuild(); | |
| } | |
| public ImageSource ImageSource |
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 TileCanvas : Canvas | |
| { | |
| public static readonly DependencyProperty ImageSourceProperty = DependencyProperty.Register("ImageSource", typeof(ImageSource), typeof(TileCanvas), new PropertyMetadata(null, ImageSourceChanged)); | |
| private Size lastActualSize; | |
| public TileCanvas() | |
| { | |
| LayoutUpdated += OnLayoutUpdated; | |
| } |
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
| /// <summary> | |
| /// C# port of http://raksy.dyndns.org/cycle_collection.py via http://stackoverflow.com/questions/8946563/add-square-to-polygon-composed-of-squares | |
| /// </summary> | |
| static class SquaresToPolygonGenerator | |
| { | |
| static readonly Coordinate[] directions = new[] | |
| { | |
| Coordinate.West, | |
| Coordinate.South, | |
| Coordinate.East, |