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
class Program | |
{ | |
static async Task Main(string[] args) | |
{ | |
try | |
{ | |
await Task.Run(async () => await LongProcessAsync()); | |
} | |
catch (Exception e) | |
{ |
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"?> | |
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<!-- Property --> | |
<PropertyGroup> | |
<SmartDataAccessorTargetName>$(AssemblyName).DataAccessor</SmartDataAccessorTargetName> | |
<SmartDataAccessorAssembly>$(SmartDataAccessorTargetName).dll</SmartDataAccessorAssembly> | |
<SmartDataAccessorDebugSymbol>$(SmartDataAccessorTargetName).pdb</SmartDataAccessorDebugSymbol> | |
</PropertyGroup> |
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"?> | |
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<PropertyGroup> | |
<GenerateFileName>$(AssemblyName).sha256</GenerateFileName> | |
</PropertyGroup> | |
<!-- For build output --> | |
<Target Name="GenerateGetCopyToOutputDirectoryItems" | |
BeforeTargets="GetCopyToOutputDirectoryItems"> |
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 Android.App; | |
using Android.Content.PM; | |
using Android.OS; | |
using Android.Support.V7.App; | |
using Android.Views; | |
using Xamarin.Forms.Platform.Android; | |
[Activity( | |
Theme = "@style/MainTheme", |
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
############################### | |
# Core EditorConfig Options # | |
############################### | |
root = true | |
# All files | |
[*] | |
indent_style = space |
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 AppViewModelBase<T> : ViewModelBase | |
where T : AppViewModelBase<T> | |
{ | |
public static T DesignInstance { get; } = null; // For design | |
} |
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; | |
public interface IPolicy | |
{ | |
string ToName(string source); | |
} | |
public sealed class DefaultPolicy : IPolicy | |
{ | |
public string ToName(string source) => source; |
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; | |
using System.Collections.Generic; | |
using System.Linq; | |
using BenchmarkDotNet.Attributes; | |
[Config(typeof(BenchmarkConfig))] | |
public class ConvertEnumerableBenchmark | |
{ |
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
// Good | |
public static async Task<T> UseTemporary<T>(Func<string, Task<T>> func) | |
{ | |
var path = Path.GetTempFileName(); | |
try | |
{ | |
return await func(path); | |
} | |
finally | |
{ |
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 LowercaseControllerModelConvention : IControllerModelConvention | |
{ | |
public void Apply(ControllerModel controller) | |
{ | |
controller.ControllerName = controller.ControllerName.ToLower(); | |
foreach (var action in controller.Actions) | |
{ | |
action.ActionName = action.ActionName.ToLower(); | |
} | |
} |