Skip to content

Instantly share code, notes, and snippets.

@hiiru
hiiru / WebJobsStartup.cs
Created August 6, 2019 08:43
Azure Functions KeyVault Configuration workaround
using Microsoft.Azure.KeyVault;
using Microsoft.Azure.Services.AppAuthentication;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration.AzureKeyVault;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using System;
using System.Linq;
@hiiru
hiiru / 1. Type lookup
Last active April 24, 2019 07:00
Reflection type lookup and constructor lookup with cache
private static readonly ConcurrentDictionary<string, Type> _typeCache = new ConcurrentDictionary<string, Type>();
public static Type GetTypeByFullName(string fullName)
{
if (_typeCache.TryGetValue(fullName, out Type type))
return type;
var paramTypes = GetAllTypesOf(typeof(Param));
if (paramTypes.Any())
{
var match = paramTypes.FirstOrDefault(x => x.FullName == fullName);
@hiiru
hiiru / example output
Created November 21, 2014 12:14
Windows batch %* example
C:\Temp>test.cmd "i'm the first" followed and futher "things here"
First arg: "i'm the first"
2nd arg: followed
all args: "i'm the first" followed and futher "things here"