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
| ok = response.Terminal.Value.ToUpper() == "OK" ? true : false; | |
| Task save = new Task(new Action(() => _orderService.SaveOrderParametersAsync(parameters))); | |
| save.Start(); | |
| Task.WaitAny(new Task[] { save }); |
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.Threading; | |
| public class RwLock : IDisposable | |
| { | |
| private readonly ReaderWriterLockSlim _innerLock = new ReaderWriterLockSlim(); | |
| private bool _disposed = false; | |
| public IDisposable Read() | |
| { |
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 Linx | |
| { | |
| [Test] | |
| public void Select() | |
| { | |
| var ints = new[] { 1, 2, 3 }; | |
| var squares = ints.Select(x => x * x); | |
| CollectionAssert.AreEqual(new[] { 1, 4, 9 }, squares); | |
| } |
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 readonly DependencyProperty $propertyName$Property = $ownerType$.$propertyName$Property.AddOwner( | |
| typeof($containingType$), | |
| new FrameworkPropertyMetadata(default($propertyType$), FrameworkPropertyMetadataOptions.None)); | |
| public $propertyType$ $propertyName$ | |
| { | |
| get | |
| { | |
| return ($propertyType$)this.GetValue($propertyName$Property); | |
| } |
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.Collections.ObjectModel; | |
| using System.Linq; | |
| using System.Linq.Expressions; | |
| using System.Reflection; | |
| using System.Windows; | |
| using System.Windows.Controls; | |
| using System.Windows.Data; | |
| using Gu.Reactive; |
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
| Task save = new Task(new Action(() => _orderService.SaveOrderParametersAsync(parameters))); | |
| save.Start(); | |
| Task.WaitAny(new Task[] { save }); |
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
| new Angle\((?!, AngleUnit.Radians)(.*), AngleUnit.Radians\) | |
| Angle.FromRadians($1) | |
| new Angle\((?!, AngleUnit.Degrees)(.*), AngleUnit.Degrees\) | |
| Angle.FromDegrees($1) | |
| new Length\((?!, LengthUnit.MilliMeters)(.*), LengthUnit.MilliMeters\) | |
| Length.FromMillimetres($1) | |
| new Density\((?!, DensityUnit.GramsPerCubicCentiMeters)(.*), DensityUnit.GramsPerCubicCentiMeters\) |
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
| namespace Gu.Units.Fsharp.Tests | |
| open NUnit.Framework; | |
| open Gu.Units; | |
| [<Measure>] type sec | |
| [<Measure>] type kg | |
| [<Measure>] type m | |
| [<Measure>] type cm | |
| [<Measure>] type inch | |
| module Tests= |
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 Newtonsoft.Json; | |
| using NUnit.Framework; | |
| public class Demo | |
| { | |
| private JsonSerializerSettings _settings; | |
| [SetUp] | |
| public void SetUp() | |
| { | |
| _settings = new JsonSerializerSettings() |
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
| protected static void OnMyCollectionItemsSourceChanged(DependencyObject property, DependencyPropertyChangedEventArgs args) | |
| { | |
| var newCol = args.NewValue as INotifyCollectionChanged; | |
| if (newCol != null) | |
| { | |
| // CollectionChangedEventManager.AddListener(newCol, this); // You probably wanna do this in a control | |
| newCol.CollectionChanged += OnCollectionChanged; | |
| } | |
| var oldCol = args.OldValue as INotifyCollectionChanged; | |
| if (oldCol != null) |