var x = 1;
// same as string.Format("A {0} B", x)
var y1 = $"A {x} B"; // y == "A 1 B"
// $@ for multiline
var y2 = $@"A
This file contains 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 void Main() | |
{ | |
var config = new JobHostConfiguration(); | |
// Log Console.Out to SQL using custom TraceWriter | |
// Note: Need to update default Microsoft.Azure.WebJobs package for config.Tracing.Tracers to be exposed/available | |
config.Tracing.Tracers.Add(new SqlTraceWriter( | |
TraceLevel.Info, | |
"{{SqlConnectionString}}", | |
"{{LogTableName}}")); |
This file contains 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
// <copyright file="LeastRecentlyUsedCache.cs" company="http://www.sinbadsoft.com"> | |
// Copyright (c) Chaker Nakhli 2013 | |
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the | |
// License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by | |
// applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, | |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language | |
// governing permissions and limitations under the License. | |
// </copyright> | |
// <author>Chaker Nakhli</author> | |
// <email>Chaker.Nakhli@sinbadsoft.com</email> |
This file contains 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"?> | |
<configuration> | |
<system.webServer> | |
<staticContent> | |
<mimeMap fileExtension=".vtt" mimeType="text/vtt" /> | |
<mimeMap fileExtension=".srt" mimeType="text/srt" /> | |
<mimeMap fileExtension=".aac" mimeType="audio/aac" /> | |
<mimeMap fileExtension=".oga" mimeType="audio/ogg" /> | |
<mimeMap fileExtension=".mp4" mimeType="video/mp4" /> | |
<mimeMap fileExtension=".webm" mimeType="video/webm" /> |
This file contains 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.Security.Cryptography; | |
using System.Text; | |
namespace Snippets | |
{ | |
public static class SHA1Util | |
{ | |
/// <summary> | |
/// Compute hash for string encoded as UTF8 | |
/// </summary> |
This file contains 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 EmtpyStatementRemoval : CSharpSyntaxRewriter | |
{ | |
public override SyntaxNode VisitEmptyStatement(EmptyStatementSyntax node) | |
{ | |
//Simply remove all Empty Statements | |
return null; | |
} | |
} | |
public static void Main(string[] args) |
This file contains 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.Reflection; | |
using System.Collections.Generic; | |
using System.Linq.Expressions; | |
public static class ExpressionUtilities | |
{ | |
public static object GetValue(Expression expression) | |
{ | |
return getValue(expression, true); |
This file contains 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.Linq; | |
namespace Extensions | |
{ | |
/// <summary> | |
/// Allow the up to the first eight elements of an array to take part in C# 7's destructuring syntax. | |
/// </summary> | |
/// <example> | |
/// (int first, _, int middle, _, int[] rest) = new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; |
This file contains 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 MethodInfoExtensions | |
{ | |
/// <summary> | |
/// Return the method signature as a string. | |
/// </summary> | |
/// | |
/// <param name="property"> | |
/// The property to act on. | |
/// </param> | |
/// |
This file contains 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 Microsoft.Extensions.Options; | |
using Microsoft.AspNetCore.HttpOverrides; | |
using Lib.AspNetCore.CloudFlareConnectingIp; | |
namespace Microsoft.AspNetCore.Builder | |
{ | |
public static class CloudFlareConnectingIpExtensions | |
{ | |
public static IApplicationBuilder UseCloudFlareConnectingIp(this IApplicationBuilder app) |
OlderNewer