[
  {
    "path": ".appveyor.yml",
    "content": "image: Visual Studio 2017\n\nconfiguration: Debug\n\nbuild: off\n\ninstall:\n  - ps: nuget install FSharp.Compiler.Tools -ExcludeVersion -OutputDirectory extra\n\nbuild_script:\n  - cmd: set PATH=%PATH%;%APPVEYOR_BUILD_FOLDER%\\extra\\FSharp.Compiler.Tools\\tools\\\n  - cmd: fsi --exec ./build.fsx\n\ntest: off\n\nartifacts:\n  - path: '**\\bin\\*\\*.nupkg'\n\nskip_branch_with_pr: true\nskip_tags: true\n\ndeploy:\n  - provider: NuGet\n    server: https://www.myget.org/F/dynamitey-ci/api/v2/package\n    api_key:\n      secure: yKbBrG0QiTfXUvND1/cMMNHxH1Bgal5g7c0pWGwqvjCtKGTtWkpvE2KlZb6E2ZgB\n    skip_symbols: false\n    symbol_server: https://www.myget.org/F/dynamitey-ci/symbols/api/v2/package\n\nfor:\n  - branches:\n        except:\n          - /v.*/\n    environment:\n        vsuffix: alpha$(APPVEYOR_BUILD_NUMBER)\n        is_prerelease: true\n  - branches:\n        only:\n          - /v.*-beta/\n    environment:\n      vsuffix: beta$(APPVEYOR_BUILD_NUMBER)\n      is_prerelease: true\n  - branches:\n        only:\n          - /v[\\d,.]*/\n    configuration: Release\n    environment:\n      vsuffix: $(APPVEYOR_BUILD_NUMBER)\n      is_prerelease: false"
  },
  {
    "path": ".github/workflows/dotnet.yml",
    "content": "name: Build .net core\n\non: [push]\n\njobs:\n  build:\n    name: Test ${{ matrix.os }} for dotnet ${{ matrix.dotnet }}\n    runs-on: ${{ matrix.os }}\n    strategy:\n      matrix:\n        dotnet: [ '8.0.x' ]\n        os: [ubuntu-latest, macOS-latest]\n    \n    steps:\n    - uses: actions/checkout@v4\n    - name: Setup .NET Core\n      uses: actions/setup-dotnet@v4\n      with:\n        dotnet-version: ${{ matrix.dotnet }}\n    - name: Build with dotnet core\n      run: dotnet build --configuration Release\n    - name: Tests\n      run: dotnet test Tests/Tests.csproj --configuration Release --no-build --no-restore --filter=TestCategory!=Performance\n"
  },
  {
    "path": ".github/workflows/dotnet48.yml",
    "content": "name: Build CrossComple .net core/.net framework Windows\n\non: [push]\n\njobs:\n  build:\n    name: Test Windows .net Framework and Core\n    runs-on: windows-2022\n    steps:\n    - uses: actions/checkout@v4\n    - uses: NuGet/setup-nuget@v2\n    - uses: microsoft/setup-msbuild@v2\n      with:\n        dotnet-version: 4.8\n    - name: Restore Packages\n      run: nuget restore Dynamitey.sln\n    - name: Build solution\n      run: msbuild Dynamitey.sln -t:rebuild -property:Configuration=Release\n    - name: Test\n      uses: josepho0918/vstest-action@0e887de8dcfab5ce3eecaf4ad6320bb9b3ecf633\n      with:\n        testAssembly: Tests.dll\n        searchFolder: .\\Tests\\bin\\Release\\*\\\n        runInParallel: true\n        otherConsoleOptions: /TestCaseFilter:\"(TestCategory!=Performance)\"\n        platform: x64\n    - name: Publish\n      run:\n        dotnet nuget push '${{ github.workspace }}\\publish\\*.nupkg' --source https://nuget.pkg.github.com/ekonbenefits/index.json --api-key ${{ secrets.GITHUB_TOKEN }}"
  },
  {
    "path": ".gitignore",
    "content": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\nf\n# User-specific files\n*.suo\n*.user\n*.sln.docstates\n\n# Build results\n\n[Dd]ebug/\n[Rr]elease/\nx64/\nbuild/\n[Bb]in/\n[Oo]bj/\n\n# MSTest test Results\n[Tt]est[Rr]esult*/\n[Bb]uild[Ll]og.*\n\n*_i.c\n*_p.c\n*.ilk\n*.meta\n*.obj\n*.pch\n*.pdb\n*.pgc\n*.pgd\n*.rsp\n*.sbr\n*.tlb\n*.tli\n*.tlh\n*.tmp\n*.tmp_proj\n*.log\n*.vspscc\n*.vssscc\n.builds\n*.pidb\n*.log\n*.scc\n\n# Visual C++ cache files\nipch/\n*.aps\n*.ncb\n*.opensdf\n*.sdf\n*.cachefile\n\n# Visual Studio profiler\n*.psess\n*.vsp\n*.vspx\n\n# Guidance Automation Toolkit\n*.gpState\n\n# ReSharper is a .NET coding add-in\n_ReSharper*/\n*.[Rr]e[Ss]harper\n\n# TeamCity is a build add-in\n_TeamCity*\n\n# DotCover is a Code Coverage Tool\n*.dotCover\n\n# NCrunch\n*.ncrunch*\n.*crunch*.local.xml\n\n# Installshield output folder\n[Ee]xpress/\n\n# DocProject is a documentation generator add-in\nDocProject/buildhelp/\nDocProject/Help/*.HxT\nDocProject/Help/*.HxC\nDocProject/Help/*.hhc\nDocProject/Help/*.hhk\nDocProject/Help/*.hhp\nDocProject/Help/Html2\nDocProject/Help/html\n\n# Click-Once directory\npublish/\n\n# Publish Web Output\n*.Publish.xml\n*.pubxml\n\n# NuGet Packages Directory\n## TODO: If you have NuGet Package Restore enabled, uncomment the next line\npackages/\n\n# Windows Azure Build Output\ncsx\n*.build.csdef\n\n# Windows Store app package directory\nAppPackages/\n\n# Others\nsql/\n*.Cache\nClientBin/\n[Ss]tyle[Cc]op.*\n~$*\n*~\n*.dbmdl\n*.[Pp]ublish.xml\n*.pfx\n*.publishsettings\n\n# RIA/Silverlight projects\nGenerated_Code/\n\n# Backup & report files from converting an old project file to a newer\n# Visual Studio version. Backup files are not needed, because we have git ;-)\n_UpgradeReport_Files/\nBackup*/\nUpgradeLog*.XML\nUpgradeLog*.htm\n\n# SQL Server files\nApp_Data/*.mdf\nApp_Data/*.ldf\n\n# =========================\n# Windows detritus\n# =========================\n\n# Windows image file caches\nThumbs.db\nehthumbs.db\n\n# Folder config file\nDesktop.ini\n\n# Recycle Bin used on file shares\n$RECYCLE.BIN/\n\n# Mac crap\n.DS_Store\n\n/dist/*.nupkg\n\n*.userprefs\n\n.fake/*\n.nuget/NuGet.exe\n\n.idea/*\n.vs/*\n.ionide/*\n"
  },
  {
    "path": ".vscode/tasks.json",
    "content": "{\n    // See https://go.microsoft.com/fwlink/?LinkId=733558\n    // for the documentation about the tasks.json format\n    \"version\": \"0.1.0\",\n    \"command\": \"./build.fsx\",\n    \"args\": [\"Test\"],\n    \"windows\":{\n        \"command\": \"C:\\\\Program Files (x86)\\\\Microsoft SDKs\\\\F#\\\\4.1\\\\Framework\\\\v4.0\\\\fsi\",\n        \"args\": [\"--exec\", \"./build.fsx\", \"Test\"]\n    },\n    \"isShellCommand\": true,\n    \"showOutput\": \"always\",\n    \"problemMatcher\":\"$msCompile\"\n}"
  },
  {
    "path": "Directory.Build.props",
    "content": "<Project>\n    <PropertyGroup>\n        <WithoutCrossCompile Condition=\"'$(GITHUB_ACTION)' != '' OR '$(LGTM_SRC)' != ''\">True</WithoutCrossCompile>\n    </PropertyGroup>\n</Project>"
  },
  {
    "path": "Dynamitey/Builder.cs",
    "content": "﻿// \n//  Copyright 2011 Ekon Benefits\n// \n//    Licensed under the Apache License, Version 2.0 (the \"License\");\n//    you may not use this file except in compliance with the License.\n//    You may obtain a copy of the License at\n// \n//        http://www.apache.org/licenses/LICENSE-2.0\n// \n//    Unless required by applicable law or agreed to in writing, software\n//    distributed under the License is distributed on an \"AS IS\" BASIS,\n//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//    See the License for the specific language governing permissions and\n//    limitations under the License.\nusing System;\nusing System.Linq;\nusing Dynamitey.DynamicObjects;\n\nnamespace Dynamitey\n{\n\n\n    /// <summary>\n    /// Builds Objects with a Fluent Syntax\n    /// </summary>\n    public static class Builder\n    {\n        /// <summary>\n        /// New Builder\n        /// </summary>\n        /// <returns></returns>\n        public static IBuilder New()\n        {\n            return new Builder<ChainableDictionary>();\n        }\n\n       \n\n        /// <summary>\n        /// New Builder\n        /// </summary>\n        /// <typeparam name=\"TObjectPrototype\">The type of the object prototype.</typeparam>\n        /// <returns></returns>\n        public static IBuilder New<TObjectPrototype>() where TObjectPrototype : new()\n        {\n            return new Builder<TObjectPrototype>();\n        }\n\n        \n    }\n\n    /// <summary>\n    /// Syntax for a quick new inline prototype object\n    /// </summary>\n    public static class Build\n    {\n        private static readonly dynamic _objectBuilder = new Builder<ChainableDictionary>().Object;\n\n        private static readonly dynamic _listBuilder =\n            Dynamic.Curry(new Builder<ChainableDictionary>().ListSetup<List>()).\n                List();\n\n        /// <summary>\n        /// Gets the new object builder.\n        /// </summary>\n        /// <value>The new object.</value>\n        public static dynamic NewObject => _objectBuilder;\n\n        /// <summary>\n        /// Gets the new list builder.\n        /// </summary>\n        /// <value>The new list.</value>\n        public static dynamic NewList => _listBuilder;\n    }\n\n    /// <summary>\n    /// Syntax for a quick inline object property setup\n    /// </summary>\n    /// <typeparam name=\"TObjectPrototype\">The type of the object prototype.</typeparam>\n    public static class Build<TObjectPrototype> where TObjectPrototype : new()\n    {\n// ReSharper disable StaticFieldInGenericType\n        private static readonly dynamic _typedBuilder = new Builder<TObjectPrototype>().Object;\n// ReSharper restore StaticFieldInGenericType\n\n// ReSharper disable StaticFieldInGenericType\n        private static readonly dynamic _typedListBuilder = Dynamic.Curry(new Builder<TObjectPrototype>().ListSetup<TObjectPrototype>()).List();\n// ReSharper restore StaticFieldInGenericType\n\n        /// <summary>\n        /// Gets the new object builder.\n        /// </summary>\n        /// <value>The new.</value>\n        public static dynamic NewObject => _typedBuilder;\n\n        /// <summary>\n        /// Gets the new list builder.\n        /// </summary>\n        /// <value>The new list.</value>\n        public static dynamic NewList => _typedListBuilder;\n    }\n\n    /// <summary>\n    /// Encapsulates an Activator\n    /// </summary>\n    public class Activate\n    {\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"Activate\"/> class.\n        /// </summary>\n        /// <param name=\"type\">The type.</param>\n        /// <param name=\"args\">The args.</param>\n        public Activate(Type type, params object[] args)\n        {\n            Type = type;\n\n            var tArg = args.OfType<Func<object[]>>().SingleOrDefault();\n            if (tArg != null)\n                Arguments = tArg;\n            else\n                Arguments = () => args;\n            \n        }\n\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"Activate\"/> class. With Factory Function\n        /// </summary>\n        /// <param name=\"type\">The type.</param>\n        /// <param name=\"args\">The args.</param>\n        public Activate(Type type, Func<object[]> args)\n        {\n            Type = type;\n            Arguments = args;\n        }\n        /// <summary>\n        /// Gets or sets the constructor type.\n        /// </summary>\n        /// <value>The type.</value>\n        public virtual Type Type { get; private set; }\n\n        /// <summary>\n        /// Gets or sets the constructor arguments.\n        /// </summary>\n        /// <value>The arguments.</value>\n        public virtual Func<object[]> Arguments\n        {\n            get; private set;\n        }\n\n        /// <summary>\n        /// Creates this instance.\n        /// </summary>\n        /// <returns></returns>\n        public virtual dynamic Create()\n        {\n            object[] tArgs = Arguments();\n            return Dynamic.InvokeConstructor(Type, tArgs);\n        }\n    }\n\n    /// <summary>\n    /// Encapsulates an Activator\n    /// </summary>\n    /// <typeparam name=\"TObjectPrototype\">The type of the object prototype.</typeparam>\n    public class Activate<TObjectPrototype> : Activate\n    {\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"Activate&lt;TObjectPrototype&gt;\"/> class.\n        /// </summary>\n        /// <param name=\"args\">The args.</param>\n        public Activate(params object[] args) : base(typeof(TObjectPrototype), args)\n        {\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"Activate&lt;TObjectPrototype&gt;\"/> class. With Factory Function\n        /// </summary>\n        /// <param name=\"args\">The args.</param>\n        public Activate(Func<object[]> args)\n            : base(typeof(TObjectPrototype), args)\n        {\n        }\n\n        /// <summary>\n        /// Creates this instance.\n        /// </summary>\n        /// <returns></returns>\n        public override dynamic Create()\n        {\n            var tArgs = Arguments();\n\n            if(tArgs.Any())\n                return base.Create();\n\n\n            TObjectPrototype tObjectPrototype;\n            try\n            {\n                tObjectPrototype = Activator.CreateInstance<TObjectPrototype>();//Try first because it's really fast, but won't work with optional parameters\n            }\n            catch (Exception)\n            {\n                tObjectPrototype = Dynamic.InvokeConstructor(typeof(TObjectPrototype));\n            }\n            return tObjectPrototype;\n        }\n    }\n\n\n}\n"
  },
  {
    "path": "Dynamitey/CacheableInvocation.cs",
    "content": "﻿using System;\nusing System.Dynamic;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing Dynamitey.Internal.Optimization;\nusing Microsoft.CSharp.RuntimeBinder;\nusing System.Reflection;\nusing Dynamitey.Internal.Compat;\nusing System.Collections;\nusing System.Collections.Generic;\n\nnamespace Dynamitey\n{\n    /// <summary>\n    /// Cacheable representation of an invocation without the target or arguments  also by default only does public methods to make it easier to cache.\n    ///  /// </summary>\n\n    public class CacheableInvocation:Invocation\n    {\n        /// <summary>\n        /// Creates the cacheable convert call.\n        /// </summary>\n        /// <param name=\"convertType\">Type of the convert.</param>\n        /// <param name=\"convertExplicit\">if set to <c>true</c> [convert explicit].</param>\n        /// <returns></returns>\n        public static CacheableInvocation CreateConvert(Type convertType, bool convertExplicit=false)\n        {\n            return new CacheableInvocation(InvocationKind.Convert, convertType: convertType, convertExplicit: convertExplicit);\n        }\n\n        /// <summary>\n        /// Creates the cacheable method or indexer or property call.\n        /// </summary>\n        /// <param name=\"kind\">The kind.</param>\n        /// <param name=\"name\">The name.</param>\n        /// <param name=\"callInfo\">The callInfo.</param>\n        /// <param name=\"context\">The context.</param>\n        /// <returns></returns>\n        public static CacheableInvocation CreateCall(InvocationKind kind, String_OR_InvokeMemberName name = null, CallInfo callInfo = null,object context = null)\n        {\n            var tArgCount = callInfo?.ArgumentCount ?? 0;\n            var tArgNames = callInfo?.ArgumentNames.ToArray();\n\n            return new CacheableInvocation(kind, name, tArgCount, tArgNames, context);\n        }\n\n        private readonly int _argCount;\n        private readonly string[] _argNames;\n        private readonly bool _staticContext;\n        private readonly Type _context;\n\n        //[NonSerialized]\n        private CallSite _callSite;\n        //[NonSerialized]\n        private CallSite _callSite2;\n        //[NonSerialized]\n        private CallSite _callSite3;\n        //[NonSerialized]\n        private CallSite _callSite4;\n\n        private readonly bool _convertExplicit;\n        private readonly Type _convertType;\n\n     \n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"CacheableInvocation\"/> class.\n        /// </summary>\n        /// <param name=\"kind\">The kind.</param>\n        /// <param name=\"name\">The name.</param>\n        /// <param name=\"argCount\">The arg count.</param>\n        /// <param name=\"argNames\">The arg names.</param>\n        /// <param name=\"context\">The context.</param>\n        /// <param name=\"convertType\">Type of the convert.</param>\n        /// <param name=\"convertExplicit\">if set to <c>true</c> [convert explict].</param>\n        /// <param name=\"storedArgs\">The stored args.</param>\n        public CacheableInvocation(InvocationKind kind,\n                                   String_OR_InvokeMemberName name=null,\n                                   int argCount =0,\n                                   string[] argNames =null,\n                                   object context = null,\n                                   Type convertType = null,\n                                   bool convertExplicit = false, \n                                   object[] storedArgs = null)\n            : base(kind, name, storedArgs)\n        {\n\n            _convertType = convertType;\n            _convertExplicit = convertExplicit;\n\n            _argNames = argNames ?? new string[] {};\n\n            if (storedArgs != null)\n            {\n                _argCount = storedArgs.Length;\n                Args = Util.GetArgsAndNames(storedArgs, out var tArgNames);\n                if (_argNames.Length < tArgNames.Length)\n                {\n                    _argNames = tArgNames;\n                }\n            }\n\n            switch (kind) //Set required argcount values\n            {\n                case InvocationKind.GetIndex:\n                    if (argCount < 1)\n                    {\n                        throw new ArgumentException(\"Arg Count must be at least 1 for a GetIndex\", nameof(argCount));\n                    }\n                    _argCount = argCount;\n                    break;\n                case InvocationKind.SetIndex:\n                    if (argCount < 2)\n                    {\n                        throw new ArgumentException(\"Arg Count Must be at least 2 for a SetIndex\", nameof(argCount));\n                    }\n                    _argCount = argCount;\n                    break;\n                case InvocationKind.Convert:\n                    _argCount = 0;\n                    if(convertType==null)\n                        throw new ArgumentNullException(nameof(convertType),\" Convert Requires Convert Type \");\n                    break;\n                case InvocationKind.SubtractAssign:\n                case InvocationKind.AddAssign:\n                case InvocationKind.Set:\n                    _argCount = 1;\n                    break;\n                case InvocationKind.Get:\n                case InvocationKind.IsEvent:\n                    _argCount = 0;\n                    break;\n                default:\n                    _argCount = Math.Max(argCount, _argNames.Length);\n                    break;\n            }\n\n            if (_argCount > 0)//setup argName array\n            {\n                var tBlank = new string[_argCount];\n                if (_argNames.Length != 0)\n                    Array.Copy(_argNames, 0, tBlank, tBlank.Length - _argNames.Length, _argNames.Length);\n                else\n                    tBlank = null;\n                _argNames = tBlank;\n            }\n\n\n            if (context != null)\n            {\n                var dummy = context.GetTargetContext(out _context, out _staticContext); //lgtm [cs/useless-assignment-to-local]\n            }\n            else\n            {\n                _context = typeof (object);\n            }\n\n\n        }\n\n        /// <summary>\n        /// Equalses the specified other.\n        /// </summary>\n        /// <param name=\"other\">The other.</param>\n        /// <returns></returns>\n        public bool Equals(CacheableInvocation other)\n        {\n            if (ReferenceEquals(null, other)) return false;\n            if (ReferenceEquals(this, other)) return true;\n            return base.Equals(other) \n                && other._argCount == _argCount \n                && (_argNames ?? new string[] { }).SequenceEqual(other._argNames ?? new string[] { })\n                && other._staticContext.Equals(_staticContext)\n                && Equals(other._context, _context) \n                && other._convertExplicit.Equals(_convertExplicit)\n                && Equals(other._convertType, _convertType);\n        }\n\n        /// <summary>\n        /// Determines whether the specified <see cref=\"System.Object\" /> is equal to this instance.\n        /// </summary>\n        /// <param name=\"obj\">The <see cref=\"System.Object\" /> to compare with this instance.</param>\n        /// <returns>\n        ///   <c>true</c> if the specified <see cref=\"System.Object\" /> is equal to this instance; otherwise, <c>false</c>.\n        /// </returns>\n        public override bool Equals(object obj)\n        {\n            if (ReferenceEquals(null, obj)) return false;\n            if (ReferenceEquals(this, obj)) return true;\n            return Equals(obj as CacheableInvocation);\n        }\n\n        /// <summary>\n        /// Returns a hash code for this instance.\n        /// </summary>\n        /// <returns>\n        /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. \n        /// </returns>\n        public override int GetHashCode()\n        {\n            unchecked\n            {\n                int result = base.GetHashCode();\n                result = (result*397) ^ _argCount;\n                result = (result*397) ^ (_argNames != null ? ((IStructuralEquatable)_argNames).GetHashCode(EqualityComparer<string>.Default) : 0);\n                result = (result*397) ^ _staticContext.GetHashCode();\n                result = (result*397) ^ (_context != null ? _context.GetHashCode() : 0);\n                result = (result*397) ^ _convertExplicit.GetHashCode();\n                result = (result*397) ^ (_convertType != null ? _convertType.GetHashCode() : 0);\n                return result;\n            }\n        }\n\n\n        /// <summary>\n        /// Invokes the invocation on specified target with specific args.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <param name=\"args\">The args.</param>\n        /// <returns></returns>\n        /// <exception cref=\"System.ArgumentException\">CacheableInvocation can't change conversion type on invoke.;args</exception>\n        /// <exception cref=\"System.InvalidOperationException\">Unknown Invocation Kind: </exception>\n        public override object Invoke(object target, params object[] args)\n        {\n            if (target is InvokeContext tIContext)\n            {\n                target = tIContext.Target;\n            }\n\n            if (args == null)\n            {\n                args = new object[]{null};\n            }\n           \n\n            if (args.Length != _argCount)\n            {\n                switch (Kind)\n                {\n                    case InvocationKind.Convert:\n                        if (args.Length > 0)\n                        {\n                            if (!Equals(args[0], _convertType))\n                                throw new ArgumentException(\"CacheableInvocation can't change conversion type on invoke.\", nameof(args));\n                        }\n                        if (args.Length > 1)\n                        {\n                            if(!Equals(args[1], _convertExplicit))\n                                throw new ArgumentException(\"CacheableInvocation can't change explicit/implicit conversion on invoke.\", nameof(args));\n                        }\n\n                        if(args.Length > 2)\n                            goto default;\n                        break;\n                    default:\n                        throw new ArgumentException(\"args\",\n                            $\"Incorrect number of Arguments for CachedInvocation, Expected:{_argCount}\");\n                }\n            }\n\n            switch (Kind)\n            {\n                case InvocationKind.Constructor:\n                    var tTarget = (Type) target;\n                    return InvokeHelper.InvokeConstructorCallSite(tTarget, tTarget.GetTypeInfo().IsValueType, args, _argNames,\n                                                                  ref _callSite);\n                case InvocationKind.Convert:\n                    return InvokeHelper.InvokeConvertCallSite(target, _convertExplicit, _convertType, _context,\n                                                              ref _callSite);\n                case InvocationKind.Get:\n                    return InvokeHelper.InvokeGetCallSite(target, Name.Name, _context, _staticContext, ref _callSite);\n                case InvocationKind.Set:\n                    InvokeHelper.InvokeSetCallSite(target, Name.Name, args[0], _context, _staticContext, ref _callSite);\n                    return null;\n                case InvocationKind.GetIndex:\n                    return InvokeHelper.InvokeGetIndexCallSite(target, args, _argNames, _context, _staticContext, ref _callSite);\n                case InvocationKind.SetIndex:\n                    Dynamic.InvokeSetIndex(target, args);\n                    return null;\n                case InvocationKind.InvokeMember:\n                    return InvokeHelper.InvokeMemberCallSite(target, (InvokeMemberName) Name, args, _argNames, _context, _staticContext, ref _callSite);\n                case InvocationKind.InvokeMemberAction:\n                    InvokeHelper.InvokeMemberActionCallSite(target, (InvokeMemberName)Name, args, _argNames, _context, _staticContext, ref _callSite);\n                    return null;\n                case InvocationKind.InvokeMemberUnknown:\n                    {\n                       \n                            try\n                            {\n                                var tObj = InvokeHelper.InvokeMemberCallSite(target, (InvokeMemberName)Name, args, _argNames, _context, _staticContext, ref _callSite);\n                                return tObj;\n                            }\n                            catch (RuntimeBinderException)\n                            {\n                                InvokeHelper.InvokeMemberActionCallSite(target, (InvokeMemberName)Name, args, _argNames, _context, _staticContext, ref _callSite2);\n                            return null;\n\n                            }\n                          \n                    }\n                case InvocationKind.Invoke:\n                    return InvokeHelper.InvokeDirectCallSite(target, args, _argNames, _context, _staticContext, ref _callSite);\n                case InvocationKind.InvokeAction:\n                    InvokeHelper.InvokeDirectActionCallSite(target, args, _argNames, _context, _staticContext, ref _callSite);\n                    return null;\n                case InvocationKind.InvokeUnknown:\n                    {\n\n                        try\n                        {\n                            var tObj = InvokeHelper.InvokeDirectCallSite(target, args, _argNames, _context, _staticContext, ref _callSite);\n                            return tObj;\n                        }\n                        catch (RuntimeBinderException)\n                        {\n                            InvokeHelper.InvokeDirectActionCallSite(target, args, _argNames, _context, _staticContext, ref _callSite2);\n                            return null;\n\n                        }\n                    }\n                case InvocationKind.AddAssign:\n                    InvokeHelper.InvokeAddAssignCallSite(target, Name.Name, args, _argNames, _context, _staticContext,ref _callSite,ref  _callSite2,ref _callSite3, ref _callSite4);\n                    return null;\n                case InvocationKind.SubtractAssign:\n                    InvokeHelper.InvokeSubtractAssignCallSite(target, Name.Name, args, _argNames, _context, _staticContext, ref _callSite, ref _callSite2, ref _callSite3, ref _callSite4);\n                    return null;\n                case InvocationKind.IsEvent:\n                    return InvokeHelper.InvokeIsEventCallSite(target, Name.Name, _context, ref _callSite);\n                default:\n                    throw new InvalidOperationException(\"Unknown Invocation Kind: \" + Kind);\n            }\n        }\n\n       \n    }\n}\n"
  },
  {
    "path": "Dynamitey/Dynamic.cs",
    "content": "﻿// \n//  Copyright 2010  Ekon Benefits\n// \n//    Licensed under the Apache License, Version 2.0 (the \"License\");\n//    you may not use this file except in compliance with the License.\n//    You may obtain a copy of the License at\n// \n//        http://www.apache.org/licenses/LICENSE-2.0\n// \n//    Unless required by applicable law or agreed to in writing, software\n//    distributed under the License is distributed on an \"AS IS\" BASIS,\n//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//    See the License for the specific language governing permissions and\n//    limitations under the License.\n\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Dynamic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Reflection;\nusing System.Runtime.CompilerServices;\n\nusing Dynamitey.Internal;\nusing Dynamitey.Internal.Optimization;\nusing Microsoft.CSharp.RuntimeBinder;\nusing System.Text.RegularExpressions;\nusing Dynamitey.Internal.Compat;\n\nnamespace Dynamitey\n{\n    using System;\n\n\n\n\n    /// <summary>\n    /// Main API\n    /// </summary>\n    public static class Dynamic\n    {\n        /// <summary>\n        /// Clears the dynamic binding caches.\n        /// </summary>\n        public static void ClearCaches()\n        {\n            InvokeHelper.ClearAllCaches();\n        }\n\n    \n\n        private static readonly dynamic ComBinder\n            = new DynamicObjects.LateType(\"System.Dynamic.ComBinder, System.Dynamic, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\");\n        \n        // ReSharper disable once MemberCanBePrivate.Global\n        internal static readonly dynamic Impromptu\n            = new DynamicObjects.LateType(\"ImpromptuInterface.Impromptu, ImpromptuInterface, PublicKeyToken=0b1781c923b2975b\");\n        \n        // ReSharper disable once MemberCanBePrivate.Global\n        internal static readonly dynamic TypeDescriptor\n             = new DynamicObjects.LateType(\"System.ComponentModel.TypeDescriptor, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\");\n    \n            \n        private static readonly Type ComObjectType;\n        // ReSharper disable once MemberCanBePrivate.Global\n        internal static readonly Type TypeConverterAttributeSL;\n\n        static Dynamic()\n        {\n            try\n            {\n                ComObjectType = typeof(object).GetTypeInfo().Assembly.GetType(\"System.__ComObject\");\n            }\n            catch\n            {\n                ComObjectType = null;\n            }\n            try\n            {\n                TypeConverterAttributeSL\n                    = Type.GetType(\"System.ComponentModel.TypeConverter, System, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e\", false);  \n            }\n            catch\n            {\n                TypeConverterAttributeSL = null;\n            }\n        }\n        \n        /// <summary>\n        /// Creates a cached call site at runtime.\n        /// </summary>\n        /// <param name=\"delegateType\">Type of the delegate.</param>\n        /// <param name=\"binder\">The CallSite binder.</param>\n        /// <param name=\"name\">Member Name</param>\n        /// <param name=\"context\">Permissions Context type</param>\n        /// <param name=\"argNames\">The arg names.</param>\n        /// <param name=\"staticContext\">if set to <c>true</c> [static context].</param>\n        /// <param name=\"isEvent\">if set to <c>true</c> [is event].</param>\n        /// <returns>The CallSite</returns>\n        /// <remarks>\n        /// Advanced usage only for serious custom dynamic invocation.\n        /// </remarks>\n        /// <seealso cref=\"CreateCallSite{T}\"/>\n        public static CallSite CreateCallSite(Type delegateType, CallSiteBinder binder, String_OR_InvokeMemberName name,\n                                              Type context, string[] argNames = null, bool staticContext = false,\n                                              bool isEvent = false) =>\n            InvokeHelper.CreateCallSite(delegateType, binder.GetType(), InvokeHelper.Unknown, \n                () => binder, (InvokeMemberName)name, context, argNames, staticContext, isEvent);\n\n        /// <summary>\n        /// Creates the call site.\n        /// </summary>\n        /// <typeparam name=\"T\"></typeparam>\n        /// <param name=\"binder\">The binder.</param>\n        /// <param name=\"name\">The name.</param>\n        /// <param name=\"context\">The context.</param>\n        /// <param name=\"argNames\">The arg names.</param>\n        /// <param name=\"staticContext\">if set to <c>true</c> [static context].</param>\n        /// <param name=\"isEvent\">if set to <c>true</c> [is event].</param>\n        /// <returns></returns>\n        /// /// \n        /// <example>\n        /// Unit test that exhibits usage\n        /// <code><![CDATA[\n        /// string tResult = String.Empty;\n        /// var tPoco = new MethOutPoco();\n        /// var tBinder =\n        /// Binder.InvokeMember(BinderFlags.None, \"Func\", null, GetType(),\n        /// new[]\n        /// {\n        /// Info.Create(\n        /// InfoFlags.None, null),\n        /// Info.Create(\n        /// InfoFlags.IsOut |\n        /// InfoFlags.UseCompileTimeType, null)\n        /// });\n        /// var tSite = Impromptu.CreateCallSite<DynamicTryString>(tBinder);\n        /// tSite.Target.Invoke(tSite, tPoco, out tResult);\n        /// Assert.AreEqual(\"success\", tResult);\n        /// ]]></code>\n        /// </example>\n        /// <seealso cref=\"CreateCallSite\"/>\n        public static CallSite<T> CreateCallSite<T>(CallSiteBinder binder, String_OR_InvokeMemberName name, Type context,\n                                                    string[] argNames = null, bool staticContext = false,\n                                                    bool isEvent = false) where T : class \n            => InvokeHelper.CreateCallSite<T>(binder.GetType(), InvokeHelper.Unknown, \n                () => binder, (InvokeMemberName) name, context, argNames, staticContext, isEvent);\n\n\n        /// <summary>\n        /// Puts a dynamic linq proxy around the specified enumerable.\n        /// </summary>\n        /// <param name=\"enumerable\">The enumerable.</param>\n        /// <returns></returns>\n        public static dynamic Linq(object enumerable)\n        {\n            if (enumerable\n                .GetType()\n                .GetTypeInfo()\n                .GetInterfaces()\n                .Where(it => it.GetTypeInfo().IsGenericType)\n                .Any(it => it.GetGenericTypeDefinition() == typeof(IEnumerable<>)))\n            {\n                return new DynamicObjects.LinqInstanceProxy(enumerable);\n            }\n\n            if (enumerable is IEnumerable tempEnumerable)\n            {\n                enumerable = tempEnumerable.Cast<object>();\n            }\n\n            return new DynamicObjects.LinqInstanceProxy(enumerable);\n        }\n\n    \n\n        /// <summary>\n        /// Dynamically Invokes a member method using the DLR\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <param name=\"name\">The name. Can be a string it will be implicitly converted</param>\n        /// <param name=\"args\">The args.</param>\n        /// <returns> The result</returns>\n        /// <example>   \n        /// Unit test that exhibits usage:\n        /// <code>\n        /// <![CDATA[\n        ///    dynamic tExpando = new ExpandoObject();\n        ///    tExpando.Func = new Func<int, string>(it => it.ToString());\n        ///\n        ///    var tValue = 1;\n        ///    var tOut = Impromptu.InvokeMember(tExpando, \"Func\", tValue);\n        ///\n        ///    Assert.AreEqual(tValue.ToString(), tOut);\n        /// ]]>\n        /// </code>\n        /// </example>\n        public static dynamic InvokeMember(object target, String_OR_InvokeMemberName name, params object[] args)\n        {\n            target = target.GetTargetContext(out var context, out var staticContext);\n            args = Util.GetArgsAndNames(args, out var argNames);\n            CallSite callSite = null;\n\n            return InvokeHelper.InvokeMemberCallSite(target, (InvokeMemberName)name, args, argNames, context, staticContext,\n                                                     ref callSite);\n        }\n\n\n        /// <summary>\n        /// Invokes the binary operator.\n        /// </summary>\n        /// <param name=\"leftArg\">The left arg.</param>\n        /// <param name=\"op\">The op.</param>\n        /// <param name=\"rightArg\">The right Arg.</param>\n        /// <returns></returns>\n        public static dynamic InvokeBinaryOperator(dynamic leftArg, ExpressionType op, dynamic rightArg)\n        {\n            switch (op)\n            {\n                case ExpressionType.Add:\n                    return leftArg + rightArg;\n                case ExpressionType.AddAssign:\n                    leftArg += rightArg;\n                    return leftArg;\n                case ExpressionType.AndAssign:\n                    leftArg &= rightArg;\n                    return leftArg;\n                case ExpressionType.Divide:\n                    return leftArg/rightArg;\n                case ExpressionType.DivideAssign:\n                    leftArg /= rightArg;\n                    return leftArg;\n                case ExpressionType.Equal:\n                    return leftArg == rightArg;\n                case ExpressionType.ExclusiveOr:\n                    return leftArg ^ rightArg;\n                case ExpressionType.ExclusiveOrAssign:\n                    leftArg ^= rightArg;\n                    return leftArg;\n                case ExpressionType.GreaterThan:\n                    return leftArg > rightArg;\n                case ExpressionType.GreaterThanOrEqual:\n                    return leftArg >= rightArg;\n                case ExpressionType.LeftShift:\n                    return leftArg << rightArg;\n                case ExpressionType.LeftShiftAssign:\n                    leftArg <<= rightArg;\n                    return leftArg;\n                case ExpressionType.LessThan:\n                    return leftArg < rightArg;\n                case ExpressionType.LessThanOrEqual:\n                    return leftArg <= rightArg;\n                case ExpressionType.Modulo:\n                    return leftArg%rightArg;\n                case ExpressionType.ModuloAssign:\n                    leftArg %= rightArg;\n                    return leftArg;\n                case ExpressionType.Multiply:\n                    return leftArg*rightArg;\n                case ExpressionType.MultiplyAssign:\n                    leftArg *= rightArg;\n                    return leftArg;\n                case ExpressionType.NotEqual:\n                    return leftArg != rightArg;\n                case ExpressionType.OrAssign:\n                    leftArg |= rightArg;\n                    return leftArg;\n                case ExpressionType.RightShift:\n                    return leftArg >> rightArg;\n                case ExpressionType.RightShiftAssign:\n                    leftArg >>= rightArg;\n                    return leftArg;\n                case ExpressionType.Subtract:\n                    return leftArg - rightArg;\n                case ExpressionType.SubtractAssign:\n                    leftArg -= rightArg;\n                    return leftArg;\n                case ExpressionType.Or:\n                    return leftArg | rightArg;\n                case ExpressionType.And:\n                    return leftArg & rightArg;\n                case ExpressionType.OrElse:\n                    return leftArg || rightArg;\n                case ExpressionType.AndAlso:\n                    return leftArg && rightArg;\n                default:\n                    throw new ArgumentException(\"Unsupported Operator\", nameof(op));\n            }\n        }\n\n\n        [Obsolete(\"Use `InvokeUnaryOperator` instead.\")]\n        // ReSharper disable once IdentifierTypo\n        public static dynamic InvokeUnaryOpartor(ExpressionType op, dynamic arg)\n            => InvokeUnaryOperator(op, (object)arg);\n        \n        /// <summary>\n        /// Invokes the unary operator.\n        /// </summary>\n        /// <param name=\"arg\">The arg.</param>\n        /// <param name=\"op\">The op.</param>\n        /// <returns></returns>\n        public static dynamic InvokeUnaryOperator(ExpressionType op, dynamic arg)\n        {\n            switch (op)\n            {\n                case ExpressionType.Not:\n                    return !arg;\n                case ExpressionType.Negate:\n                    return -arg;\n                case ExpressionType.Decrement:\n                    return --arg;\n                case ExpressionType.Increment:\n                    return ++arg;\n                default:\n                    throw new ArgumentException(\"Unsupported Operator\", nameof(op));\n            }\n        }\n\n        /// <summary>\n        /// Invokes the specified target using the DLR;\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <param name=\"args\">The args.</param>\n        /// <returns></returns>\n        public static dynamic Invoke(object target, params object[] args)\n        {\n            target = target.GetTargetContext(out var context, out var staticContext);\n            args = Util.GetArgsAndNames(args, out var argNames);\n            CallSite callSite = null;\n\n            return InvokeHelper.InvokeDirectCallSite(target, args, argNames, context, staticContext, ref callSite);\n        }\n\n\n        /// <summary>\n        /// Dynamically Invokes indexer using the DLR.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <param name=\"indexes\">The indexes.</param>\n        /// <returns></returns>\n        public static dynamic InvokeGetIndex(object target, params object[] indexes)\n        {\n            target = target.GetTargetContext(out var tContext, out var tStaticContext);\n            indexes = Util.GetArgsAndNames(indexes, out var tArgNames);\n            CallSite tCallSite = null;\n\n            return InvokeHelper.InvokeGetIndexCallSite(target, indexes, tArgNames, tContext, tStaticContext,\n                                                       ref tCallSite);\n        }\n\n\n        /// <summary>\n        /// Convenience version of InvokeSetIndex that separates value and indexes.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <param name=\"value\">The value</param>\n        /// <param name=\"indexes\">The indexes </param>\n        /// <returns></returns>\n        public static object InvokeSetValueOnIndexes(object target, object value, params object[] indexes)\n        {\n            var tList = new List<object>(indexes) {value};\n            return InvokeSetIndex(target, indexesThenValue: tList.ToArray());\n        }\n\n        /// <summary>\n        /// Invokes setindex.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <param name=\"indexesThenValue\">The indexes then value.</param>\n        public static object InvokeSetIndex(object target, params object[] indexesThenValue)\n        {\n            if (indexesThenValue.Length < 2)\n            {\n                throw new ArgumentException(\"Requires at least one index and one value\", nameof(indexesThenValue));\n            }\n\n            target = target.GetTargetContext(out var tContext, out var tStaticContext);\n            indexesThenValue = Util.GetArgsAndNames(indexesThenValue, out var tArgNames);\n\n            CallSite tCallSite = null;\n            return InvokeHelper.InvokeSetIndexCallSite(target, indexesThenValue, tArgNames, tContext, tStaticContext,\n                                                ref tCallSite);\n        }\n\n        /// <summary>\n        /// Dynamically Invokes a member method which returns void using the DLR\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <param name=\"name\">The name.</param>\n        /// <param name=\"args\">The args.</param>\n        /// <example>\n        /// Unit test that exhibits usage:\n        /// <code>\n        /// <![CDATA[\n        ///    var tTest = \"Wrong\";\n        ///    var tValue = \"Correct\";\n        ///\n        ///    dynamic tExpando = new ExpandoObject();\n        ///    tExpando.Action = new Action<string>(it => tTest = it);\n        ///\n        ///    Impromptu.InvokeMemberAction(tExpando, \"Action\", tValue);\n        ///\n        ///    Assert.AreEqual(tValue, tTest);\n        /// ]]>\n        /// </code>\n        /// </example>\n        public static void InvokeMemberAction(object target, String_OR_InvokeMemberName name, params object[] args)\n        {\n            target = target.GetTargetContext(out var tContext, out var tStaticContext);\n            args = Util.GetArgsAndNames(args, out var tArgNames);\n\n            CallSite tCallSite = null;\n            InvokeHelper.InvokeMemberActionCallSite(target, (InvokeMemberName)name, args, tArgNames, tContext, tStaticContext,\n                                                    ref tCallSite);\n        }\n\n        /// <summary>\n        /// Invokes the action using the DLR\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <param name=\"args\">The args.</param>\n        public static void InvokeAction(object target, params object[] args)\n        {\n            target = target.GetTargetContext(out var tContext, out var tStaticContext);\n            args = Util.GetArgsAndNames(args, out var tArgNames);\n\n            CallSite tCallSite = null;\n            InvokeHelper.InvokeDirectActionCallSite(target, args, tArgNames, tContext, tStaticContext, ref tCallSite);\n        }\n\n\n        /// <summary>\n        /// Dynamically Invokes a set member using the DLR.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <param name=\"name\">The name.</param>\n        /// <param name=\"value\">The value.</param>\n        /// <example>\n        /// Unit test that exhibits usage:\n        /// <code>\n        /// <![CDATA[\n        ///    dynamic tExpando = new ExpandoObject();\n        ///\n        ///    var tSetValue = \"1\";\n        ///\n        ///    Impromptu.InvokeSet(tExpando, \"Test\", tSetValue);\n        ///\n        ///    Assert.AreEqual(tSetValue, tExpando.Test);\n        /// ]]>\n        /// </code>\n        /// </example>\n        /// <remarks>\n        /// if you call a static property off a type with a static context the csharp dlr binder won't do it, so this method reverts to reflection\n        /// </remarks>\n        public static object InvokeSet(object target, string name, object value)\n        {\n            target = target.GetTargetContext(out var tContext, out var tStaticContext);\n            tContext = tContext.FixContext();\n\n\n            CallSite tCallSite = null;\n            return InvokeHelper.InvokeSetCallSite(target, name, value, tContext, tStaticContext, ref tCallSite);\n        }\n\n        /// <summary>\n        /// Invokes the set on the end of a property chain.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <param name=\"propertyChain\">The property chain.</param>\n        /// <param name=\"value\">The value.</param>\n        public static object InvokeSetChain(object target, string propertyChain, object value)\n        {\n            var tProperties = _chainRegex.FluentMatches(propertyChain).ToList();\n            var tGetProperties = tProperties.Take(tProperties.Count - 1);\n\n       \n            var tTarget = target;\n            foreach (var tProperty in tGetProperties)\n            {\n                var tGetter = tProperty.Getter;\n                var tIntIndexer = tProperty.IntIndexer;\n                var tStringIndexer = tProperty.StringIndexer;\n\n                if (tGetter != null)\n                    tTarget = InvokeGet(tTarget, tGetter);\n                else if (tIntIndexer != null)\n                    tTarget = InvokeGetIndex(tTarget, Dynamic.CoerceConvert(tIntIndexer, typeof(int)));\n                else if (tStringIndexer != null)\n                    tTarget = InvokeGetIndex(tTarget, tStringIndexer);\n                else\n                {\n                    throw new Exception($\"Could Not Parse :'{propertyChain}'\");\n                }\n            }\n\n            var tSetProperty = tProperties.Last();\n\n            var tSetGetter = tSetProperty.Getter;\n            var tSetIntIndexer = tSetProperty.IntIndexer;\n            var tSetStringIndexer = tSetProperty.StringIndexer;\n\n            if (tSetGetter != null)\n                return InvokeSet(tTarget, tSetGetter, value);\n            if (tSetIntIndexer != null)\n                return InvokeSetIndex(tTarget, Dynamic.CoerceConvert(tSetIntIndexer, typeof(int)), value);\n            if (tSetStringIndexer != null)\n                return InvokeSetIndex(tTarget, tSetStringIndexer, value);\n            \n            throw new Exception($\"Could Not Parse :'{propertyChain}'\");\n        }\n\n           \n\n\n\n\n        private static readonly dynamic _invokeSetAll = new InvokeSetters();\n\n        /// <summary>\n        /// Call Like method invokes set on target and a list of property/value. Invoke with dictionary, anonymous type or named arguments.\n        /// </summary>\n        /// <value>The invoke set all.</value>\n        public static dynamic InvokeSetAll => _invokeSetAll;\n\n        /// <summary>\n        /// Wraps a target to partial apply a method (or target if you can invoke target directly eg delegate).\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <param name=\"totalArgCount\">The total arg count.</param>\n        /// <returns></returns>\n        public static dynamic Curry(object target, int? totalArgCount = null)\n        {\n            if (target is Delegate && !totalArgCount.HasValue)\n                return Curry((Delegate) target);\n            return new Curry(target, totalArgCount);\n        }\n\n        /// <summary>\n        /// Wraps a delegate to partially apply it.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <returns></returns>\n        public static dynamic Curry(Delegate target)\n        {\n            return new Curry(target, target.GetMethodInfo().GetParameters().Length);\n        }\n\n\n\n        /// <summary>\n        /// Dynamically Invokes a get member using the DLR.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <param name=\"name\">The name.</param>\n        /// <returns>The result.</returns>\n        /// <example>\n        /// Unit Test that describes usage\n        /// <code>\n        /// <![CDATA[\n        ///    var tSetValue = \"1\";\n        ///    var tAnon = new { Test = tSetValue };\n        ///\n        ///    var tOut =Impromptu.InvokeGet(tAnon, \"Test\");\n        ///\n        ///    Assert.AreEqual(tSetValue, tOut);\n        /// ]]>\n        /// </code>\n        /// </example>\n        public static dynamic InvokeGet(object target, string name)\n        {\n            target = target.GetTargetContext(out var tContext, out var tStaticContext);            CallSite tSite = null;\n            return InvokeHelper.InvokeGetCallSite(target, name, tContext, tStaticContext, ref tSite);\n        }\n\n\n  private static readonly Regex _chainRegex\n           = new Regex(@\"((\\.?(?<Getter>\\w+))|(\\[(?<IntIndexer>\\d+)\\])|(\\['(?<StringIndexer>\\w+)'\\]))\");\n\n        /// <summary>\n        /// Invokes the getter property chain.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <param name=\"propertyChain\">The property chain.</param>\n        /// <returns></returns>\n        public static dynamic InvokeGetChain(object target, string propertyChain)\n        {\n            var tProperties = _chainRegex.FluentMatches(propertyChain);\n            var tTarget = target;\n            foreach (var tProperty in tProperties)\n            {\n                var tGetter = tProperty.Getter;\n                var tIntIndexer = tProperty.IntIndexer;\n                var tStringIndexer = tProperty.StringIndexer;\n\n                if (tGetter != null)\n                    tTarget = InvokeGet(tTarget, tGetter);\n                else if (tIntIndexer != null)\n                    tTarget = InvokeGetIndex(tTarget, Dynamic.CoerceConvert(tIntIndexer,typeof(int)));\n                else if (tStringIndexer != null)\n                    tTarget = InvokeGetIndex(tTarget, tStringIndexer);\n                else\n                {\n                    throw new Exception($\"Could Not Parse :'{propertyChain}'\");\n                }\n            }\n            return tTarget;\n        }\n\n        /// <summary>\n        /// Determines whether the specified name on target is event. This allows you to know whether to InvokeMemberAction\n        ///  add_{name} or a combo of {invokeGet, +=, invokeSet} and the corresponding remove_{name} \n        /// or a combo of {invokeGet, -=, invokeSet}\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <param name=\"name\">The name.</param>\n        /// <returns>\n        /// \t<c>true</c> if the specified target is event; otherwise, <c>false</c>.\n        /// </returns>\n        public static bool InvokeIsEvent(object target, string name)\n        {\n            target = target.GetTargetContext(out var tContext, out var tStaticContext);\n            tContext = tContext.FixContext();\n            CallSite tCallSite = null;\n            return InvokeHelper.InvokeIsEventCallSite(target, name, tContext, ref tCallSite);\n        }\n\n        /// <summary>\n        /// Invokes add assign with correct behavior for events.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <param name=\"name\">The name.</param>\n        /// <param name=\"value\">The value.</param>\n        public static void InvokeAddAssignMember(object target, string name, object value)\n        {\n            CallSite callSiteAdd =null;\n            CallSite callSiteGet =null;\n            CallSite callSiteSet =null;\n            CallSite callSiteIsEvent = null;\n            target = target.GetTargetContext(out var context, out var staticContext);\n\n            var args = new[] { value };\n            args = Util.GetArgsAndNames(args, out var argNames);\n\n            InvokeHelper.InvokeAddAssignCallSite(target, name, args, argNames, context, staticContext, ref callSiteIsEvent, ref callSiteAdd, ref callSiteGet, ref callSiteSet);\n        }\n\n        /// <summary>\n        /// Invokes subtract assign with correct behavior for events.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <param name=\"name\">The name.</param>\n        /// <param name=\"value\">The value.</param>\n        public static void InvokeSubtractAssignMember(object target, string name, object value)\n        {\n            target = target.GetTargetContext(out var context, out var staticContext);\n\n            var args = new[] { value };\n\n            args = Util.GetArgsAndNames(args, out var argNames);\n\n\n            CallSite callSiteIsEvent = null;\n            CallSite callSiteRemove = null;\n            CallSite callSiteGet = null;\n            CallSite callSiteSet = null;\n\n\n            InvokeHelper.InvokeSubtractAssignCallSite(target, name, args, argNames, context, staticContext, ref callSiteIsEvent, ref callSiteRemove, ref callSiteGet,ref  callSiteSet);\n        }\n\n        /// <summary>\n        /// Invokes  convert using the DLR.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <param name=\"type\">The type.</param>\n        /// <param name=\"explicit\">if set to <c>true</c> [explicit].</param>\n        /// <returns></returns>\n        public static dynamic InvokeConvert(object target, Type type, bool @explicit =false)\n        {\n            target = target.GetTargetContext(out var tContext, out var tDummy);\n\n            CallSite tCallSite =null;\n            return InvokeHelper.InvokeConvertCallSite(target, @explicit, type, tContext, ref tCallSite);\n\n        }\n\n        internal static readonly IDictionary<Type, Delegate> CompiledExpressions = new Dictionary<Type, Delegate>();\n\n        /// <summary>\n        /// Coerces any invokable to specified delegate type.\n        /// </summary>\n        /// <param name=\"invokeableObject\">The invokeable object.</param>\n        /// <param name=\"delegateType\">Type of the delegate.</param>\n        /// <returns></returns>\n        public static dynamic CoerceToDelegate(object invokeableObject, Type delegateType)\n            {\n                var delegateTypeInfo = delegateType.GetTypeInfo();\n                if (!typeof(Delegate).GetTypeInfo().IsAssignableFrom(delegateTypeInfo.BaseType))\n                {\n                    return null;\n                }\n                var tDelMethodInfo = delegateTypeInfo.GetMethod(\"Invoke\");\n                if (tDelMethodInfo is null)\n                {\n                    throw new Exception(\"This Delegate Didn't have and Invoke method! Impossible!\");\n                }\n                var tReturnType = tDelMethodInfo.ReturnType;\n                var tAction = tReturnType == typeof(void);\n                var tParams = tDelMethodInfo.GetParameters();\n                var tLength = tDelMethodInfo.GetParameters().Length;\n                Delegate tBaseDelegate = tAction\n                                             ? InvokeHelper.WrapAction(invokeableObject, tLength)\n                                             : InvokeHelper.WrapFunc(tReturnType, invokeableObject, tLength);\n\n\n                if (InvokeHelper.IsActionOrFunc(delegateType) &&\n                    !tParams.Any(it => it.ParameterType.GetTypeInfo().IsValueType))\n                {\n                    return tBaseDelegate;\n                }\n\n                if (CompiledExpressions.TryGetValue(delegateType, out var tGetResult))\n                {\n                    return tGetResult.DynamicInvoke(tBaseDelegate);\n                }\n\n                var tParamTypes = tParams.Select(it => it.ParameterType).ToArray();\n                var tDelParam = Expression.Parameter(tBaseDelegate.GetType());\n                var tInnerParams = tParamTypes.Select(Expression.Parameter).ToArray();\n\n                var tI = Expression.Invoke(tDelParam,\n                    tInnerParams.Select(it => (Expression)Expression.Convert(it, typeof(object))));\n                var tL = Expression.Lambda(delegateType, tI, tInnerParams);\n\n                tGetResult =\n                    Expression.Lambda(Expression.GetFuncType(tBaseDelegate.GetType(), delegateType), tL,\n                        tDelParam).Compile();\n                CompiledExpressions[delegateType] = tGetResult;\n\n                return tGetResult.DynamicInvoke(tBaseDelegate);\n\n            }\n\n        private static readonly dynamic LateConvert = new DynamicObjects.LateType(typeof(Convert));\n\n\n        /// <summary>\n        /// Determines whether value is DBNull dynamically (Useful for PCL)\n        /// </summary>\n        /// <param name=\"value\">The value.</param>\n        /// <returns>\n        ///   <c>true</c> if [is DBNull]; otherwise, <c>false</c>.\n        /// </returns>\n        public static bool IsDBNull(object value)\n        {\n\n            try\n            {\n                \n                return LateConvert.IsDBNull(value);\n            }\n            catch\n            {\n                return false;\n            }\n        }\n\n        /// <summary>\n        /// Applies the equivalent type hint to dynamic object\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <param name=\"types\">The types.</param>\n        public static void ApplyEquivalentType(DynamicObjects.IEquivalentType target, params Type[] types)\n        {\n            if(types.Length == 1)\n                target.EquivalentType = types.First();\n            else\n                target.EquivalentType = new DynamicObjects.AggreType(types.ConvertEach<DynamicObjects.FauxType>().ToArray());\n          \n        }\n\n\n\n        /// <summary>\n        /// Implicit or Explicit Converts the items of the specified enumerable.\n        /// </summary>\n        /// <typeparam name=\"T\"></typeparam>\n        /// <param name=\"enumerable\">The enumerable.</param>\n        /// <param name=\"explicit\">if set to <c>true</c> [explicit].</param>\n        /// <returns></returns>\n        [Obsolete(\"Use ConvertEach.\")]\n        public static IEnumerable<T> ConvertAll<T>(this System.Collections.IEnumerable enumerable, bool explict = false)\n            => ConvertEach<T>(enumerable, explict);\n        \n        /// <summary>\n        /// Implicit or Explicit Converts the items of the specified enumerable.\n        /// </summary>\n        /// <typeparam name=\"T\"></typeparam>\n        /// <param name=\"enumerable\">The enumerable.</param>\n        /// <param name=\"explicit\">if set to <c>true</c> [explicit].</param>\n        /// <returns></returns>\n        public static IEnumerable<T> ConvertEach<T>(this System.Collections.IEnumerable enumerable, bool @explicit =false)\n        {\n            return enumerable.Cast<object>().Select(it => InvokeConvert(it, typeof (T), @explicit)).Cast<T>();\n        } \n\n        /// <summary>\n        /// Goes the extra mile to convert target to type.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <param name=\"type\">The type.</param>\n        /// <returns></returns>\n        public static dynamic CoerceConvert(object target, Type type)\n        {\n            var typeInfo = type.GetTypeInfo();\n            if (target != null && !typeInfo.IsInstanceOfType(target) && !IsDBNull(target))\n            {\n\n                var delegateConversion = CoerceToDelegate(target, type);\n\n                if (delegateConversion != null)\n                    return delegateConversion;\n\n\n                if (typeInfo.IsInterface && Impromptu.IsAvailable)\n                {\n\n\n                \n                    if (target is IDictionary<string, object> tDict && !(tDict is DynamicObjects.BaseObject))\n                    {\n                        target = new DynamicObjects.Dictionary(tDict);\n                    }\n                    else if(!(target is DynamicObjects.BaseObject))\n                    {\n                        target = new DynamicObjects.Get(target);\n                    }\n\n\n                    target = Impromptu.DynamicActLike(target, type);\n                }\n                else\n                {\n                \n\n                    try\n                    {\n                        object tResult = Dynamic.InvokeConvert(target, type, @explicit: true);\n\n                        target = tResult;\n                    }\n                    catch (RuntimeBinderException)\n                    {\n                        Type tReducedType = type;\n                        if (typeInfo.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>))\n                        {\n                            tReducedType = typeInfo.GetGenericArguments().First();\n                        }\n\n                        if (typeof (Enum).GetTypeInfo().IsAssignableFrom(tReducedType) && target is string sVal)\n                        {\n                            target = Enum.Parse(tReducedType, sVal, true);\n\n                        }\n                        else if (target is IConvertible && typeof (IConvertible).GetTypeInfo().IsAssignableFrom(tReducedType))\n                        {\n\n                            target = Convert.ChangeType(target, tReducedType, Net40.GetDefaultThreadCurrentCulture());\n\n                        }\n                        else\n                        {\n                            try\n                            {\n                                dynamic converter = null;\n                                if (TypeDescriptor.IsAvailable)\n                                {\n                                    converter = TypeDescriptor.GetConverter(tReducedType);\n                                }\n                                else if (TypeConverterAttributeSL != null) \n                                {\n                                        var tAttributes =\n                                            tReducedType.GetTypeInfo().GetCustomAttributes(TypeConverterAttributeSL, false);\n                                        dynamic attribute = tAttributes.FirstOrDefault();\n                                        if (attribute != null)\n                                        {\n                                            converter =\n                                                Impromptu.InvokeConstructor(Type.GetType(attribute.ConverterTypeName));\n                                        }\n                                }\n                                \n\n                                if (converter != null && converter.CanConvertFrom(target.GetType()))\n                                {\n                                    target = converter.ConvertFrom(target);\n                                }\n                            }\n                            catch (RuntimeBinderException)\n                            {\n                                //This runtime converter block is a hail mary\n                                //lgtm [cs/empty-catch-block]\n                            }\n                        }\n\n                    }\n                }\n            }\n            else if (((target == null) || IsDBNull(target )) && typeInfo.IsValueType)\n            {\n                target = Dynamic.InvokeConstructor(type);\n            }\n            else if (!typeInfo.IsInstanceOfType(target) && IsDBNull(target))\n            {\n                return null;\n            }\n            return target;\n        }\n\n        /// <summary>\n        /// Invokes the constructor.\n        /// </summary>\n        /// <param name=\"type\">The type.</param>\n        /// <param name=\"args\">The args.</param>\n        /// <returns></returns>\n        public static dynamic InvokeConstructor(Type type, params object[] args)\n        {\n            var tValue = type.GetTypeInfo().IsValueType;\n            if (tValue && args.Length == 0)  //dynamic invocation doesn't see constructors of value types\n            {\n                return Activator.CreateInstance(type);\n            }\n\n           args = Util.GetArgsAndNames( args, out var tArgNames);\n           CallSite tCallSite = null;\n\n\n            return InvokeHelper.InvokeConstructorCallSite(type, tValue, args, tArgNames, ref tCallSite);\n        }\n\n\n        /// <summary>\n        /// FastDynamicInvoke extension method. Runs up to runs up to 20x faster than <see cref=\"System.Delegate.DynamicInvoke\"/> .\n        /// </summary>\n        /// <param name=\"del\">The del.</param>\n        /// <param name=\"args\">The args.</param>\n        /// <returns></returns>\n\t\tpublic static object FastDynamicInvoke(this Delegate del, params object[] args)\n\t\t{\n            if (del.GetMethodInfo().ReturnType != typeof(void))\n            {\n                return InvokeHelper.FastDynamicInvokeReturn(del, args);\n            }\n            InvokeHelper.FastDynamicInvokeAction(del, args);\n            return null;\n        }\n\n        /// <summary>\n        /// Given a generic parameter count and whether it returns void or not gives type of Action or Func\n        /// </summary>\n        /// <param name=\"paramCount\">The param count.</param>\n        /// <param name=\"returnVoid\">if set to <c>true</c> [return void].</param>\n        /// <returns>Type of Action or Func</returns>\n        public static Type GenericDelegateType(int paramCount, bool returnVoid = false)\n        {\n            var tParamCount = returnVoid ? paramCount : paramCount - 1;\n            if (tParamCount > 16)\n                throw new ArgumentException(\n                    $\"{(returnVoid ? \"Action\" : \"Func\")} only handle at  most {(returnVoid ? 16 : 17)} parameters\", nameof(paramCount));\n            if(tParamCount < 0)\n                throw new ArgumentException(\n                    $\"{(returnVoid ? \"Action\" : \"Func\")} must have at least {(returnVoid ? 0 : 1)} parameter(s)\", nameof(paramCount));\n\n\n            return returnVoid\n                ? InvokeHelper.ActionKinds[tParamCount]\n                : InvokeHelper.FuncKinds[tParamCount];\n        }\n\n        /// <summary>\n        /// Gets the member names of properties. Not all IDynamicMetaObjectProvider have support for this.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <param name=\"dynamicOnly\">if set to <c>true</c> [dynamic only]. Won't add reflected properties</param>\n        /// <returns></returns>\n        public static IEnumerable<string> GetMemberNames(object target, bool dynamicOnly = false)\n        {\n            var tList = new List<string>();\n            if (!dynamicOnly)\n            {\n               tList.AddRange(target.GetType().GetTypeInfo().GetProperties().Select(it => it.Name));\n            }\n\n            if (target is IDynamicMetaObjectProvider tTarget)\n            {\n                tList.AddRange(tTarget.GetMetaObject(Expression.Constant(tTarget)).GetDynamicMemberNames());\n            }else\n            {\n\n                if (ComObjectType != null && ComObjectType.GetTypeInfo().IsInstanceOfType(target) && ComBinder.IsAvailable)\n                {\n                    tList.AddRange(ComBinder.GetDynamicDataMemberNames(target));\n                }\n            }\n            return tList;\n        } \n\n        /// <summary>\n        /// Dynamically invokes a method determined by the CallSite binder and be given an appropriate delegate type\n        /// </summary>\n        /// <param name=\"callSite\">The Callsite</param>\n        /// <param name=\"target\">The target.</param>\n        /// <param name=\"args\">The args.</param>\n        /// <returns></returns>\n        /// <remarks>\n        /// Advanced use only. Use this method for serious custom invocation, otherwise there are other convenience methods such as\n        /// <see cref=\"InvokeMember\"></see>, <see cref=\"InvokeGet\"></see>, <see cref=\"InvokeSet\"></see> and <see cref=\"InvokeMemberAction\"></see>\n        /// </remarks>\n        public static dynamic InvokeCallSite(CallSite callSite, object target, params object[] args)\n        {\n         \n            \n            var tParameters = new List<object> {callSite, target};\n            tParameters.AddRange(args);\n\n            MulticastDelegate tDelegate = ((dynamic)callSite).Target;\n\n            return tDelegate.FastDynamicInvoke(tParameters.ToArray());\n        }\n\n\n    }\n\n}\n"
  },
  {
    "path": "Dynamitey/DynamicObjects/BaseDictionary.cs",
    "content": "// \n//  Copyright 2011 Ekon Benefits\n// \n//    Licensed under the Apache License, Version 2.0 (the \"License\");\n//    you may not use this file except in compliance with the License.\n//    You may obtain a copy of the License at\n// \n//        http://www.apache.org/licenses/LICENSE-2.0\n// \n//    Unless required by applicable law or agreed to in writing, software\n//    distributed under the License is distributed on an \"AS IS\" BASIS,\n//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//    See the License for the specific language governing permissions and\n//    limitations under the License.\n\nusing System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Dynamic;\nusing System.Linq;\nusing System.Reflection;\nusing System.Threading;\nusing Dynamitey.Internal.Optimization;\nusing Microsoft.CSharp.RuntimeBinder;\n\nnamespace Dynamitey.DynamicObjects\n{\n    /// <summary>\n    /// Base class of Expando-Type objects\n    /// </summary>\n\n   \n    public abstract class BaseDictionary : BaseObject, INotifyPropertyChanged\n    {\n        /// <summary>\n        /// Wrapped Dictionary\n        /// </summary>\n        protected IDictionary<string,object> _dictionary;\n\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"Dictionary\"/> class.\n        /// </summary>\n        /// <param name=\"dict\">The dict.</param>\n        protected BaseDictionary(IEnumerable<KeyValuePair<string, object>> dict =null)\n        {\n            if (dict == null)\n            {\n                _dictionary = new Dictionary<string, object>();\n                return;\n            }\n\n            if(dict is IDictionary<string,object>) //Don't need to enumerate if it's the right type.\n                _dictionary = (IDictionary<string,object>)dict;\n            else\n                _dictionary = dict.ToDictionary(k => k.Key, v => v.Value);\n        }\n\n        /// <summary>\n        /// Gets a value indicating whether this instance is read only.\n        /// </summary>\n        /// <value>\n        /// \t<c>true</c> if this instance is read only; otherwise, <c>false</c>.\n        /// </value>\n        public virtual bool IsReadOnly => false;\n\n        /// <summary>\n        /// Gets the keys.\n        /// </summary>\n        /// <value>The keys.</value>\n        public ICollection<string> Keys => _dictionary.Keys;\n\n        /// <summary>\n        /// Gets the values.\n        /// </summary>\n        /// <value>The values.</value>\n        public ICollection<object> Values => _dictionary.Values;\n\n        /// <summary>\n        /// Returns the enumeration of all dynamic member names.\n        /// </summary>\n        /// <returns>\n        /// A sequence that contains dynamic member names.\n        /// </returns>\n        public override IEnumerable<string> GetDynamicMemberNames()\n        {\n            return base.GetDynamicMemberNames().Concat(_dictionary.Keys).Distinct();\n        }\n   \n\n        /// <summary>\n        /// Provides the implementation for operations that get member values. Classes derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class can override this method to specify dynamic behavior for operations such as getting a value for a property.\n        /// </summary>\n        /// <param name=\"binder\">Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member on which the dynamic operation is performed. For example, for the Console.WriteLine(sampleObject.SampleProperty) statement, where sampleObject is an instance of the class derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class, binder.Name returns \"SampleProperty\". The binder.IgnoreCase property specifies whether the member name is case-sensitive.</param>\n        /// <param name=\"result\">The result of the get operation. For example, if the method is called for a property, you can assign the property value to <paramref name=\"result\"/>.</param>\n        /// <returns>\n        /// true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a run-time exception is thrown.)\n        /// </returns>\n        public override bool TryGetMember(GetMemberBinder binder, out object result)\n        {\n\n            if (_dictionary.TryGetValue(binder.Name, out result))\n            {\n                return this.MassageResultBasedOnInterface(binder.Name, true, ref result);\n            }\n\n            result = null;\n            return this.MassageResultBasedOnInterface(binder.Name, false, ref result);\n        }\n\n        /// <summary>\n        /// Provides the implementation for operations that invoke a member. Classes derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class can override this method to specify dynamic behavior for operations such as calling a method.\n        /// </summary>\n        /// <param name=\"binder\">Provides information about the dynamic operation. The binder.Name property provides the name of the member on which the dynamic operation is performed. For example, for the statement sampleObject.SampleMethod(100), where sampleObject is an instance of the class derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class, binder.Name returns \"SampleMethod\". The binder.IgnoreCase property specifies whether the member name is case-sensitive.</param>\n        /// <param name=\"args\">The arguments that are passed to the object member during the invoke operation. For example, for the statement sampleObject.SampleMethod(100), where sampleObject is derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class, <paramref name=\"args\"/> is equal to 100.</param>\n        /// <param name=\"result\">The result of the member invocation.</param>\n        /// <returns>\n        /// true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.)\n        /// </returns>\n        public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result)\n        {\n            if (_dictionary.TryGetValue(binder.Name, out result))\n            {\n                var tFunc = result as Delegate;\n                if (result == null)\n                    return false;\n                if (!binder.CallInfo.ArgumentNames.Any() && tFunc != null)\n                {\n                    try\n                    {\n                        result = this.InvokeMethodDelegate(tFunc, args);\n                    }\n                    catch (RuntimeBinderException)//If it has out parmaters etc it can't be invoked dynamically like this.\n                    //if we return false it will be handle by the GetProperty and then handled by the original dynamic invocation \n                    {\n                        return false;\n                    }\n                   \n                }\n                else\n                {\n                    try\n                    {\n                        result = Dynamic.Invoke(result, Util.NameArgsIfNecessary(binder.CallInfo, args));\n                    }\n                    catch (RuntimeBinderException)\n                        //If it has out parmaters etc it can't be invoked dynamically like this.\n                        //if we return false it will be handle by the GetProperty and then handled by the original dynamic invocation \n                    {\n                        return false;\n                    }\n                } \n                return this.MassageResultBasedOnInterface(binder.Name, true, ref result);\n            }\n            return this.MassageResultBasedOnInterface(binder.Name, false, ref result);\n        }\n\n      \n\n        /// <summary>\n        /// Provides the implementation for operations that set member values. Classes derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class can override this method to specify dynamic behavior for operations such as setting a value for a property.\n        /// </summary>\n        /// <param name=\"binder\">Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member to which the value is being assigned. For example, for the statement sampleObject.SampleProperty = \"Test\", where sampleObject is an instance of the class derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class, binder.Name returns \"SampleProperty\". The binder.IgnoreCase property specifies whether the member name is case-sensitive.</param>\n        /// <param name=\"value\">The value to set to the member. For example, for sampleObject.SampleProperty = \"Test\", where sampleObject is an instance of the class derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class, the <paramref name=\"value\"/> is \"Test\".</param>\n        /// <returns>\n        /// true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.)\n        /// </returns>\n        public override bool TrySetMember(SetMemberBinder binder, object value)\n        {\n       \n            SetProperty(binder.Name,value);\n            return true;\n        }\n\n        /// <summary>\n        /// Adds the specified item.\n        /// </summary>\n        /// <param name=\"item\">The item.</param>\n        public void Add(KeyValuePair<string, object> item)\n        {\n            SetProperty(item.Key, item.Value);\n        }\n\n        /// <summary>\n        /// Determines whether [contains] [the specified item].\n        /// </summary>\n        /// <param name=\"item\">The item.</param>\n        /// <returns>\n        /// \t<c>true</c> if [contains] [the specified item]; otherwise, <c>false</c>.\n        /// </returns>\n        public bool Contains(KeyValuePair<string, object> item)\n        {\n            return _dictionary.Contains(item);\n        }\n\n        /// <summary>\n        /// Copies to.\n        /// </summary>\n        /// <param name=\"array\">The array.</param>\n        /// <param name=\"arrayIndex\">Index of the array.</param>\n        public void CopyTo(KeyValuePair<string, object>[] array, int arrayIndex)\n        {\n            _dictionary.CopyTo(array,arrayIndex);\n        }\n\n        /// <summary>\n        /// Removes the specified item.\n        /// </summary>\n        /// <param name=\"item\">The item.</param>\n        /// <returns></returns>\n        public bool Remove(KeyValuePair<string, object> item)\n        {\n            if (TryGetValue(item.Key, out var tValue))\n            {\n                if (item.Value == tValue)\n                {\n                    Remove(item.Key);\n                }\n            }\n            return false;\n        }\n\n        /// <summary>\n        /// Determines whether the specified key contains key.\n        /// </summary>\n        /// <param name=\"key\">The key.</param>\n        /// <returns>\n        /// \t<c>true</c> if the specified key contains key; otherwise, <c>false</c>.\n        /// </returns>\n        public bool ContainsKey(string key)\n        {\n            return _dictionary.ContainsKey(key);\n        }\n\n        /// <summary>\n        /// Adds the specified key.\n        /// </summary>\n        /// <param name=\"key\">The key.</param>\n        /// <param name=\"value\">The value.</param>\n        public void Add(string key, object value)\n        {\n            SetProperty(key,value);\n        }\n\n        /// <summary>\n        /// Removes the specified key.\n        /// </summary>\n        /// <param name=\"key\">The key.</param>\n        /// <returns></returns>\n        public bool Remove(string key)\n        {\n            var tReturn = _dictionary.Remove(key);\n            OnPropertyChanged(key);\n            return tReturn;\n        }\n\n        /// <summary>\n        /// Tries the get value.\n        /// </summary>\n        /// <param name=\"key\">The key.</param>\n        /// <param name=\"value\">The value.</param>\n        /// <returns></returns>\n        public bool TryGetValue(string key, out object value)\n        {\n            return _dictionary.TryGetValue(key, out value);\n        }\n\n\n\n        /// <summary>\n        /// Sets the property.\n        /// </summary>\n        /// <param name=\"key\">The key.</param>\n        /// <param name=\"value\">The value.</param>\n        protected void SetProperty(string key, object value)\n        {\n            if (!_dictionary.TryGetValue(key, out var tOldValue) || value != tOldValue)\n            {\n                _dictionary[key] = value;\n                OnPropertyChanged(key);\n            }\n        }\n\n        /// <summary>\n        /// Called when [property changed].\n        /// </summary>\n        /// <param name=\"key\">The key.</param>\n        protected virtual void OnPropertyChanged(string key)\n        {\n            if (PropertyChanged != null)\n            {\n                PropertyChanged(this, new PropertyChangedEventArgs(key));\n#if SILVERLIGHT\n                 PropertyChanged(this, new PropertyChangedEventArgs(\"Item[\"+key+\"]\"));  //Indexers are Updated on Dictionarys as well\n#else\n                  PropertyChanged(this, new PropertyChangedEventArgs(\"Item[]\"));  //Indexers are Updated on Dictionarys as well WPF does not support Item[key] syntax\n#endif\n\n            }\n        }\n\n        /// <summary>\n        /// Occurs when a property value changes.\n        /// </summary>\n        public event PropertyChangedEventHandler PropertyChanged;\n\n        /// <summary>\n        /// Equalses the specified other.\n        /// </summary>\n        /// <param name=\"other\">The other.</param>\n        /// <returns></returns>\n        public bool Equals(Dictionary other)\n        {\n            if (ReferenceEquals(null, other)) return false;\n            if (ReferenceEquals(this, other)) return true;\n            return Equals(other._dictionary, _dictionary);\n        }\n\n        /// <summary>\n        /// Determines whether the specified <see cref=\"System.Object\"/> is equal to this instance.\n        /// </summary>\n        /// <param name=\"obj\">The <see cref=\"System.Object\"/> to compare with this instance.</param>\n        /// <returns>\n        /// \t<c>true</c> if the specified <see cref=\"System.Object\"/> is equal to this instance; otherwise, <c>false</c>.\n        /// </returns>\n        public override bool Equals(object obj)\n        {\n            if (ReferenceEquals(null, obj)) return false;\n            if (ReferenceEquals(this, obj)) return true;\n            if (obj.GetType() != typeof (Dictionary)) return _dictionary.Equals(obj);\n            return Equals((Dictionary) ((object) ((Dictionary) obj)));\n        }\n\n        /// <summary>\n        /// Returns a hash code for this instance.\n        /// </summary>\n        /// <returns>\n        /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. \n        /// </returns>\n        public override int GetHashCode()\n        {\n            return _dictionary.GetHashCode();\n        }\n\n        /// <summary>\n        /// Returns a <see cref=\"System.String\"/> that represents this instance.\n        /// </summary>\n        /// <returns>\n        /// A <see cref=\"System.String\"/> that represents this instance.\n        /// </returns>\n        public override string ToString()\n        {\n            return _dictionary.ToString();\n        }\n    }\n}"
  },
  {
    "path": "Dynamitey/DynamicObjects/BaseForwarder.cs",
    "content": "﻿// \n//  Copyright 2011 Ekon Benefits\n// \n//    Licensed under the Apache License, Version 2.0 (the \"License\");\n//    you may not use this file except in compliance with the License.\n//    You may obtain a copy of the License at\n// \n//        http://www.apache.org/licenses/LICENSE-2.0\n// \n//    Unless required by applicable law or agreed to in writing, software\n//    distributed under the License is distributed on an \"AS IS\" BASIS,\n//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//    See the License for the specific language governing permissions and\n//    limitations under the License.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Dynamic;\nusing System.Linq;\nusing System.Reflection;\nusing System.Text;\nusing Dynamitey.Internal.Optimization;\nusing Microsoft.CSharp;\nusing Microsoft.CSharp.RuntimeBinder;\n\nnamespace Dynamitey.DynamicObjects\n{\n\n    /// <summary>\n    /// An proxy object\n    /// </summary>\n    public interface IForwarder\n    {\n        /// <summary>\n        /// Gets the target.\n        /// </summary>\n        /// <value>The target.</value>\n        object Target { get; }\n    }\n\n    /// <summary>\n    /// Proxies Calls allows subclasser to override do extra actions before or after base invocation\n    /// </summary>\n    /// <remarks>\n    /// This may not be as efficient as other proxies that can work on just static objects or just dynamic objects...\n    /// Consider this when using.\n    /// </remarks>\n\n    public abstract class BaseForwarder : BaseObject, IForwarder\n    {\n\n        /// <summary>\n        /// Marks whether we are adding or removing the delegate\n        /// </summary>\n        public class AddRemoveMarker\n        {\n            /// <summary>\n            /// Implements the operator +.\n            /// </summary>\n            /// <param name=\"left\">The left.</param>\n            /// <param name=\"right\">The right.</param>\n            /// <returns>The result of the operator.</returns>\n            public static AddRemoveMarker operator +(AddRemoveMarker left, object right)\n            {\n                left.Delegate = right;\n                left.IsAdding = true;\n\n                return left;\n            }\n\n            /// <summary>\n            /// Implements the operator -.\n            /// </summary>\n            /// <param name=\"left\">The left.</param>\n            /// <param name=\"right\">The right.</param>\n            /// <returns>The result of the operator.</returns>\n            public static AddRemoveMarker operator -(AddRemoveMarker left, object right)\n            {\n                left.Delegate = right;\n                left.IsAdding = false;\n\n                return left;\n            }\n\n            /// <summary>\n            /// Gets or sets the delegate.\n            /// </summary>\n            /// <value>The delegate.</value>\n           \n            public object Delegate { get; protected set; }\n\n            /// <summary>\n            /// Gets or sets a value indicating whether this instance is adding.\n            /// </summary>\n            /// <value><c>true</c> if this instance is adding; otherwise, <c>false</c>.</value>\n           \n            public bool IsAdding { get; protected set; }\n\n        }\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"BaseForwarder\"/> class.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        protected BaseForwarder(object target)\n        {\n            Target = target;\n        }\n\n        /// <summary>\n        /// Returns the enumeration of all dynamic member names.\n        /// </summary>\n        /// <returns>\n        /// A sequence that contains dynamic member names.\n        /// </returns>\n        public override IEnumerable<string> GetDynamicMemberNames()\n        {\n           \n                var tDyanmic = Dynamic.GetMemberNames(CallTarget, dynamicOnly: true);\n                if (!tDyanmic.Any())\n                {\n                    return Dynamic.GetMemberNames(CallTarget);\n                }\n            \n            return base.GetDynamicMemberNames();\n        }\n\n\n        /// <summary>\n        /// Gets or sets the target.\n        /// </summary>\n        /// <value>The target.</value>\n         \n       \n        protected object Target {  get;  set; }\n\n        object IForwarder.Target => Target;\n\n        /// <summary>\n        /// Gets the call target.\n        /// </summary>\n        /// <value>The call target.</value>\n        protected virtual object CallTarget => Target;\n\n        /// <summary>\n        /// Provides the implementation for operations that get member values. Classes derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class can override this method to specify dynamic behavior for operations such as getting a value for a property.\n        /// </summary>\n        /// <param name=\"binder\">Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member on which the dynamic operation is performed. For example, for the Console.WriteLine(sampleObject.SampleProperty) statement, where sampleObject is an instance of the class derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class, binder.Name returns \"SampleProperty\". The binder.IgnoreCase property specifies whether the member name is case-sensitive.</param>\n        /// <param name=\"result\">The result of the get operation. For example, if the method is called for a property, you can assign the property value to <paramref name=\"result\"/>.</param>\n        /// <returns>\n        /// true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a run-time exception is thrown.)\n        /// </returns>\n        public override bool TryGetMember(GetMemberBinder binder, out object result)\n        {\n            if (CallTarget == null)\n            {\n                result = null;\n                return false;\n            }\n\n            if (Dynamic.InvokeIsEvent(CallTarget, binder.Name))\n            {\n                result = new AddRemoveMarker();\n                return true;\n            }\n\n            try\n            {\n                result = Dynamic.InvokeGet(CallTarget, binder.Name);\n            }\n            catch (RuntimeBinderException)\n            {\n                result = null;\n                return false;\n            }\n\n            return true;\n\n        }\n#pragma warning disable 1734\n        /// <summary>\n        /// Provides the implementation for operations that invoke an object. Classes derived from the <see cref=\"T:System.Dynamic.DynamicObject\" /> class can override this method to specify dynamic behavior for operations such as invoking an object or a delegate.\n        /// </summary>\n        /// <param name=\"binder\">Provides information about the invoke operation.</param>\n        /// <param name=\"args\">The arguments that are passed to the object during the invoke operation. For example, for the sampleObject(100) operation, where sampleObject is derived from the <see cref=\"T:System.Dynamic.DynamicObject\" /> class, <paramref name=\"args[0]\" /> is equal to 100.</param>\n        /// <param name=\"result\">The result of the object invocation.</param>\n        /// <returns>\n        /// true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.\n        /// </returns>\n#pragma warning restore 1734\n        public override bool TryInvoke(InvokeBinder binder, object[] args, out object result)\n        {\n            if (CallTarget == null)\n            {\n                result = null;\n                return false;\n            }\n\n            var tArgs = Util.NameArgsIfNecessary(binder.CallInfo, args);\n\n            try\n            {\n                result = Dynamic.Invoke(CallTarget, tArgs);\n\n            }\n            catch (RuntimeBinderException)\n            {\n                result = null;\n                try\n                {\n                    Dynamic.InvokeAction(CallTarget, tArgs);\n                }\n                catch (RuntimeBinderException)\n                {\n\n                    return false;\n                }\n            }\n            return true;\n        }\n\n        /// <summary>\n        /// Tries the invoke member.\n        /// </summary>\n        /// <param name=\"binder\">The binder.</param>\n        /// <param name=\"args\">The args.</param>\n        /// <param name=\"result\">The result.</param>\n        /// <returns></returns>\n        public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result)\n        {\n            if (CallTarget == null)\n            {\n                result = null;\n                return false;\n            }\n\n            object[] tArgs = Util.NameArgsIfNecessary(binder.CallInfo, args);\n\n\n            Type[] types = null;\n\n            try\n            { \n                //.net core\n                // Try and pull generic arguments from binder\n                IList<Type> typeList = Dynamic.InvokeGet(binder,\n                    \"TypeArguments\");\n                if (typeList != null)\n                {\n                    types = typeList.ToArray();\n                }\n\n            }\n            catch (RuntimeBinderException)\n            {\n                types = null;\n            }\n\n            if (types == null)\n            {\n                try\n                { \n                    //.net 4.0\n                    // Try and pull generic arguments from binder\n                    IList<Type> typeList = Dynamic.InvokeGet(binder,\n                        \"Microsoft.CSharp.RuntimeBinder.ICSharpInvokeOrInvokeMemberBinder.TypeArguments\");\n                    if (typeList != null)\n                    {\n\n                        types = typeList.ToArray();\n\n                    }\n\n                }\n                catch (RuntimeBinderException)\n                {\n                    types = null;\n                }\n            }\n\n            var name = InvokeMemberName.Create;\n            var fullName = name(binder.Name, types);\n            try\n            {\n                result = Dynamic.InvokeMember(CallTarget, fullName, tArgs);\n               \n            }\n            catch (RuntimeBinderException)\n            {\n                result = null;\n                try\n                {\n                    Dynamic.InvokeMemberAction(CallTarget, fullName, tArgs);\n                }\n                catch (RuntimeBinderException)\n                {\n\n                    return false;\n                }\n            }\n            return true;\n        }\n\n\n\n        /// <summary>\n        /// Tries the set member.\n        /// </summary>\n        /// <param name=\"binder\">The binder.</param>\n        /// <param name=\"value\">The value.</param>\n        /// <returns></returns>\n        public override bool TrySetMember(SetMemberBinder binder, object value)\n        {\n            if (CallTarget == null)\n            {\n                return false;\n            }\n\n            if (Dynamic.InvokeIsEvent(CallTarget, binder.Name) && value is AddRemoveMarker arm)\n            {\n      \n\n                if (arm.IsAdding)\n                {\n                    Dynamic.InvokeAddAssignMember(CallTarget, binder.Name, arm.Delegate);\n                }\n                else\n                {\n                    Dynamic.InvokeSubtractAssignMember(CallTarget, binder.Name, arm.Delegate);\n                }\n\n                return true;\n            }\n\n            try\n            {\n                Dynamic.InvokeSet(CallTarget, binder.Name, value);\n\n                return true;\n            }\n            catch (RuntimeBinderException)\n            {\n                return false;\n            }\n        }\n\n        /// <summary>\n        /// Tries the index of the get.\n        /// </summary>\n        /// <param name=\"binder\">The binder.</param>\n        /// <param name=\"indexes\">The indexes.</param>\n        /// <param name=\"result\">The result.</param>\n        /// <returns></returns>\n        public override bool TryGetIndex(GetIndexBinder binder, object[] indexes, out object result)\n        {\n            if (CallTarget == null)\n            {\n                result = null;\n                return false;\n            }\n\n            object[] tArgs = Util.NameArgsIfNecessary(binder.CallInfo, indexes);\n\n            try\n            {\n                result = Dynamic.InvokeGetIndex(CallTarget, tArgs);\n                return true;\n            }\n            catch (RuntimeBinderException)\n            {\n                result = null;\n                return false;\n            }\n        }\n\n        /// <summary>\n        /// Tries the index of the set.\n        /// </summary>\n        /// <param name=\"binder\">The binder.</param>\n        /// <param name=\"indexes\">The indexes.</param>\n        /// <param name=\"value\">The value.</param>\n        /// <returns></returns>\n        public override bool TrySetIndex(SetIndexBinder binder, object[] indexes, object value)\n        {\n            if (CallTarget == null)\n            {\n                return false;\n            }\n\n            var tCombinedArgs = indexes.Concat(new[] { value }).ToArray();\n            object[] tArgs = Util.NameArgsIfNecessary(binder.CallInfo, tCombinedArgs);\n            try\n            {\n\n\n                Dynamic.InvokeSetIndex(CallTarget, tArgs);\n                return true;\n            }\n            catch (RuntimeBinderException)\n            {\n                return false;\n            }\n        }\n\n\n        /// <summary>\n        /// Equals the specified other.\n        /// </summary>\n        /// <param name=\"other\">The other.</param>\n        /// <returns></returns>\n        public bool Equals(BaseForwarder other)\n        {\n            if (ReferenceEquals(null, other)) return ReferenceEquals(null, CallTarget);\n            if (ReferenceEquals(this, other)) return true;\n            return Equals(other.CallTarget, CallTarget);\n        }\n\n        /// <summary>\n        /// Determines whether the specified <see cref=\"System.Object\" /> is equal to this instance.\n        /// </summary>\n        /// <param name=\"obj\">The <see cref=\"System.Object\" /> to compare with this instance.</param>\n        /// <returns>\n        ///   <c>true</c> if the specified <see cref=\"System.Object\" /> is equal to this instance; otherwise, <c>false</c>.\n        /// </returns>\n        public override bool Equals(object obj)\n        {\n            if (ReferenceEquals(null, obj)) return ReferenceEquals(null, CallTarget); \n            if (ReferenceEquals(this, obj)) return true;\n            if (obj.GetType() != typeof (BaseForwarder)) return false;\n            return Equals((BaseForwarder) obj);\n        }\n\n        /// <summary>\n        /// Returns a hash code for this instance.\n        /// </summary>\n        /// <returns>\n        /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. \n        /// </returns>\n        public override int GetHashCode()\n        {\n            return (CallTarget != null ? CallTarget.GetHashCode() : 0);\n        }\n\n    \n    }\n}\n"
  },
  {
    "path": "Dynamitey/DynamicObjects/BaseObject.cs",
    "content": "// \n//  Copyright 2010  Ekon Benefits\n// \n//    Licensed under the Apache License, Version 2.0 (the \"License\");\n//    you may not use this file except in compliance with the License.\n//    You may obtain a copy of the License at\n// \n//        http://www.apache.org/licenses/LICENSE-2.0\n// \n//    Unless required by applicable law or agreed to in writing, software\n//    distributed under the License is distributed on an \"AS IS\" BASIS,\n//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//    See the License for the specific language governing permissions and\n//    limitations under the License.\n\nusing System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Dynamic;\nusing System.Linq;\nusing System.Reflection;\nusing Dynamitey.Internal.Compat;\n\nnamespace Dynamitey.DynamicObjects\n{\n\n    /// <summary>\n    /// Can Represent an equivalent static type to help dynamically convert member output\n    /// </summary>\n    public interface IEquivalentType\n    {\n        /// <summary>\n        /// Gets or sets the type of the equivalent.\n        /// </summary>\n        /// <value>\n        /// The type of the equivalent.\n        /// </value>\n        FauxType EquivalentType { get; set; }\n    }\n    \n    \n\n\n    /// <summary>\n    /// Dynamic Object that knows about the Impromtu Interface return types;\n    /// Override Typical Dynamic Object methods, and use TypeForName to get the return type of an interface member.\n    /// </summary>\n    public abstract class BaseObject : DynamicObject, IEquivalentType\n\n    {\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"BaseObject\"/> class.\n        /// </summary>\n        protected BaseObject()\n        {\n            \n        }\n\n\n\n        /// <summary>\n        /// Tries the name of the member to see if it has a type.\n        /// </summary>\n        /// <param name=\"binderName\">Name of the binder.</param>\n        /// <param name=\"type\">The type.</param>\n        /// <returns></returns>\n        public bool TryTypeForName(string binderName, out Type type)\n        {\n           var eqType = (IEquivalentType) this;\n           type = null;\n           if (eqType.EquivalentType == null)\n                return false;\n\n           var types = eqType.EquivalentType.GetMember(binderName)\n               .Select(it =>\n                           {\n\n                               switch (it)\n                               {\n                                  case PropertyInfo p:\n                                      return p.PropertyType;\n                                  case MethodInfo m:\n                                      return m.ReturnType;\n                                  case EventInfo e:\n                                      return e.EventHandlerType;\n#if NETFRAMEWORK || PROFILE158\n                                  case Type t:\n                                      return t;\n#else\n                                  case TypeInfo t:\n                                       return t.UnderlyingSystemType;\n#endif\n                                  default:\n                                      return typeof (object);\n                               }\n                               \n                           }).ToList();\n\n;\n            if (!types.Any())\n                return false;\n            foreach (var currenttype in types)\n            {\n                if (type == null || type.Name == currenttype.Name)\n                    type = currenttype;\n                else\n                    type = typeof (object);\n            }\n            return true;\n        }\n\n\n        FauxType IEquivalentType.EquivalentType { get; set; }\n    }\n}\n"
  },
  {
    "path": "Dynamitey/DynamicObjects/Builder.cs",
    "content": "﻿// \n//  Copyright 2011 Ekon Benefits\n// \n//    Licensed under the Apache License, Version 2.0 (the \"License\");\n//    you may not use this file except in compliance with the License.\n//    You may obtain a copy of the License at\n// \n//        http://www.apache.org/licenses/LICENSE-2.0\n// \n//    Unless required by applicable law or agreed to in writing, software\n//    distributed under the License is distributed on an \"AS IS\" BASIS,\n//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//    See the License for the specific language governing permissions and\n//    limitations under the License.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Dynamic;\nusing System.Linq;\nusing System.Text;\nusing System.Reflection;\nusing Dynamitey.Internal.Optimization;\nusing Dynamitey.Internal.Compat;\n\nnamespace Dynamitey.DynamicObjects\n{\n\n    /// <summary>\n    /// Interface for simplistic builder options\n    /// </summary>\n    public interface IBuilder\n    {  \n        \n        /// <summary>\n        /// Creates a prototype list\n        /// </summary>\n        /// <param name=\"contents\">The contents.</param>\n        /// <returns></returns>\n        dynamic List(params dynamic[] contents);\n\n        /// <summary>\n        /// Setup List or Array, takes either one <see cref=\"Activate\"/> or a list of constructor args that will use objects Type\n        /// </summary>\n        /// <param name=\"constructorArgs\">The constructor args.</param>\n        /// <returns></returns>\n        dynamic ListSetup(params dynamic[] constructorArgs);\n\n        /// <summary>\n        /// Setup List or Array if list has a default constrcutor\n        /// </summary>\n        /// <typeparam name=\"TList\"></typeparam>\n        /// <returns></returns>\n        dynamic ListSetup<TList>();\n\n        /// <summary>\n        /// Setup List or Array, takes either one <see cref=\"Activate\"/> or a list of constructor args that will use objects Type\n        /// </summary>\n        /// <param name=\"constructorArgsFactory\">The constructor args factory.</param>\n        /// <returns></returns>\n        dynamic ListSetup(Func<object[]> constructorArgsFactory);\n\n        /// <summary>\n        /// Setup List or Array if list has a default constrcutor\n        /// </summary>\n        /// <typeparam name=\"TList\"></typeparam>\n        /// <returns></returns>\n        dynamic ArraySetup<TList>();\n\n        /// <summary>\n        /// Alternative name for <see cref=\"ListSetup(object[])\"/>\n        /// </summary>\n        /// <param name=\"constructorArgs\">The constructor args.</param>\n        /// <returns></returns>\n        dynamic ArraySetup(params dynamic[] constructorArgs);\n\n\n        /// <summary>\n        /// Alternative name for <see cref=\"ListSetup{TList}\"/>\n        /// </summary>\n        /// <param name=\"constructorArgsFactory\">The constructor args factory.</param>\n        /// <returns></returns>\n        dynamic ArraySetup(Func<object[]> constructorArgsFactory);\n\n\n        /// <summary>\n        /// Alternative name for <see cref=\"List\"/>\n        /// </summary>\n        /// <param name=\"contents\">The contents.</param>\n        /// <returns></returns>\n        dynamic Array(params dynamic[] contents);\n\n        /// <summary>\n        /// Generates Object, use by calling with named arguments <code>builder.Object(Prop1:\"test\",Prop2:\"test\")</code>\n        /// returns new object;\n        /// </summary>\n        dynamic Object { get; }\n\n        /// <summary>\n        /// Sets up object builder\n        /// </summary>\n        /// <param name=\"constructorArgs\">The constructor args.</param>\n        /// <returns></returns>\n        dynamic ObjectSetup(params dynamic[] constructorArgs);\n\n        /// <summary>\n        /// Sets up object builder\n        /// </summary>\n        /// <param name=\"constructorArgsFactory\"></param>\n        /// <returns></returns>\n        dynamic ObjectSetup(Func<object[]> constructorArgsFactory);\n\n        /// <summary>\n        /// Setups up named builders \n        /// </summary>\n        /// <value>The setup.</value>\n        dynamic Setup { get; }\n    }\n\n    /// <summary>\n    /// Builds Expando-Like Objects with an inline Syntax\n    /// </summary>\n    /// <typeparam name=\"TObjectProtoType\">The type of the object proto type.</typeparam>\n   \n    public class Builder<TObjectProtoType>: BaseObject, IBuilder\n    {\n        /// <summary>\n        /// Build factory storage\n        /// </summary>\n       \n\t\tprotected IDictionary<string,Activate> _buildType;\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"Builder{TObjectProtoType}\"/> class.\n        /// </summary>\n\t\tpublic Builder(){\n            _buildType = new Dictionary<string, Activate>();\n\t\t\tSetup = new SetupTrampoline<TObjectProtoType>(this);\n\t\t\tObject = new BuilderTrampoline<TObjectProtoType>(this);\n\t\t}\n\t\t\n        /// <summary>\n        /// Creates a prototype list\n        /// </summary>\n        /// <param name=\"contents\">The contents.</param>\n        /// <returns></returns>\n        public dynamic List(params dynamic[] contents)\n        {\n            if (!_buildType.TryGetValue(\"List\", out var tBuildType))\n                tBuildType = null;\n\n            if (tBuildType != null)\n            {\n                dynamic tList = tBuildType.Create();\n\n                if (contents != null)\n                {\n                    foreach (var item in contents)\n                    {\n                        tList.Add(item);\n                    }\n                }\n                return tList;\n            }\n\n            return new List(contents);\n        }\n\n\n\n        /// <summary>\n        /// Setup List or Array, takes either one <see cref=\"Activate\" /> or a list of constructor args that will use objects Type\n        /// </summary>\n        /// <param name=\"constructorArgs\">The constructor args.</param>\n        /// <returns></returns>\n        public dynamic ListSetup(params dynamic[] constructorArgs)\n        {\n            var tActivate =constructorArgs.OfType<Activate>().SingleOrDefault();\n\n            \n            if (tActivate == null)\n            {\n\n                if (!_buildType.TryGetValue(\"Object\", out tActivate))\n                    tActivate = null;\n                if (tActivate != null)\n                {\n                    tActivate = new Activate(tActivate.Type,constructorArgs);\n                }\n                if(tActivate == null)\n                    tActivate = new Activate<List>(constructorArgs);\n            }\n\n            _buildType[\"List\"] = tActivate;\n            _buildType[\"Array\"] = tActivate;\n            return this;\n        }\n\n        /// <summary>\n        /// Setup List or Array if list has a default constrcutor\n        /// </summary>\n        /// <typeparam name=\"TList\"></typeparam>\n        /// <returns></returns>\n        public dynamic ListSetup<TList>()\n        {\n            return ListSetup(new Activate<TList>());\n        }\n\n        /// <summary>\n        /// Setup List or Array, takes either one <see cref=\"Activate\" /> or a list of constructor args that will use objects Type\n        /// </summary>\n        /// <param name=\"constructorArgsFactory\">The constructor args factory.</param>\n        /// <returns></returns>\n        public dynamic ListSetup(Func<object[]> constructorArgsFactory)\n        {\n            return ListSetup((object)constructorArgsFactory);\n        }\n\n        /// <summary>\n        /// Setup List or Array if list has a default constrcutor\n        /// </summary>\n        /// <typeparam name=\"TList\"></typeparam>\n        /// <returns></returns>\n        public dynamic ArraySetup<TList>()\n        {\n            return ListSetup(new Activate<TList>());\n        }\n\n        /// <summary>\n        /// Alternative name for <see cref=\"ListSetup(object[])\" />\n        /// </summary>\n        /// <param name=\"constructorArgs\">The constructor args.</param>\n        /// <returns></returns>\n        public dynamic ArraySetup(params dynamic[] constructorArgs)\n        {\n            return ListSetup(constructorArgs);\n        }\n\n        /// <summary>\n        /// Alternative name for <see cref=\"ListSetup{TList}\" />\n        /// </summary>\n        /// <param name=\"constructorArgsFactory\">The constructor args factory.</param>\n        /// <returns></returns>\n        public dynamic ArraySetup(Func<object[]> constructorArgsFactory)\n        {\n            return ListSetup((object)constructorArgsFactory);\n        }\n\n        /// <summary>\n        /// Alternative name for <see cref=\"List\"/>\n        /// </summary>\n        /// <param name=\"contents\">The contents.</param>\n        /// <returns></returns>\n        public dynamic Array(params dynamic[] contents)\n        {\n            return List(contents);\n        }\n\n        /// <summary>\n        /// Creates a Prototype object.\n        /// </summary>\n        /// <value>The object.</value>\n        public dynamic Object { get; }\n\n        /// <summary>\n        /// Sets up object builder\n        /// </summary>\n        /// <param name=\"constructorArgs\">The constructor args.</param>\n        /// <returns></returns>\n        public dynamic ObjectSetup(params dynamic[] constructorArgs)\n        {\n            _buildType[\"Object\"] = new Activate<TObjectProtoType>(constructorArgs);\n            return this;\n        }\n\n        /// <summary>\n        /// Sets up object builder\n        /// </summary>\n        /// <param name=\"constructorArgsFactory\"></param>\n        /// <returns></returns>\n        public dynamic ObjectSetup(Func<object[]> constructorArgsFactory)\n        {\n            return ObjectSetup((object) constructorArgsFactory);\n        }\n\n        /// <summary>\n        /// Trapoline for setting up Builders\n        /// </summary>\n        public dynamic Setup { get; private set; }\n\n\n        ///<summary>\n        /// Trampoline for builder\n        ///</summary>\n        public class BuilderTrampoline<TInnerObjectProtoType> : DynamicObject\n        {\n            Builder<TInnerObjectProtoType> _buider;\n\n            /// <summary>\n            /// Initializes a new instance of the <see cref=\"Builder{TObjectProtoType}.BuilderTrampoline\"/> class.\n            /// </summary>\n            /// <param name=\"builder\">The builder.</param>\n            public BuilderTrampoline(Builder<TInnerObjectProtoType> builder)\n            {\n\t\t\t\t_buider = builder;\n\t\t\t}\n\n            /// <summary>\n            /// Tries the invoke.\n            /// </summary>\n            /// <param name=\"binder\">The binder.</param>\n            /// <param name=\"args\">The args.</param>\n            /// <param name=\"result\">The result.</param>\n            /// <returns></returns>\n            public override bool TryInvoke(InvokeBinder binder, object[] args, out object result)\n            {\n                if (!_buider._buildType.TryGetValue(\"Object\", out var tBuildType))\n                    tBuildType = null;\n\n                result = InvokeHelper(binder.CallInfo, args, tBuildType);\n                return true;\n            }\n        }\n\n        /// <summary>\n        /// Trampoline for setup builder\n        /// </summary>\n        public class SetupTrampoline<TInnerObjectProtoType> : DynamicObject\n        {\n\t\t\tBuilder<TInnerObjectProtoType> _buider;\n\n            /// <summary>\n            /// Initializes a new instance of the <see cref=\"Builder{TObjectProtoType}.SetupTrampoline\"/> class.\n            /// </summary>\n            /// <param name=\"builder\">The builder.</param>\n\t\t\tpublic SetupTrampoline(Builder<TInnerObjectProtoType> builder){\n\t\t\t\t_buider = builder;\n\t\t\t}\n\n            /// <summary>\n            /// Tries the invoke.\n            /// </summary>\n            /// <param name=\"binder\">The binder.</param>\n            /// <param name=\"args\">The args.</param>\n            /// <param name=\"result\">The result.</param>\n            /// <returns></returns>\n            /// <exception cref=\"System.ArgumentException\">Requires argument names for every argument</exception>\n            public override bool TryInvoke(InvokeBinder binder, dynamic[] args, out object result)\n            {\n\t\t\t\tif (binder.CallInfo.ArgumentNames.Count != binder.CallInfo.ArgumentCount)\n               \t\t throw new ArgumentException(\"Requires argument names for every argument\");\n                var tArgs = args.Select(it => it is Type ? new Activate(it) : (Activate) it);\n                foreach (var tKeyPair in binder.CallInfo.ArgumentNames.Zip(tArgs, (n, a) => new KeyValuePair<string, Activate>(n, a)))\n                {\n\t\t\t\t\t_buider._buildType[tKeyPair.Key]=tKeyPair.Value;\n\t\t\t\t}\n\t\t\t\tresult = _buider;\n\t\t\t\treturn true;\n            }\n\n        }\n\n        /// <summary>\n        /// Tries the set member.\n        /// </summary>\n        /// <param name=\"binder\">The binder.</param>\n        /// <param name=\"value\">The value.</param>\n        /// <returns></returns>\n\t\tpublic override bool TrySetMember(SetMemberBinder binder, dynamic value){\n            if (value != null)\n            {\n                if (value is Type)\n                {\n                    _buildType[binder.Name] = new Activate(value);\n                    return true;\n                }\n\n                if (value is Activate)\n                {\n                    _buildType[binder.Name] = value;\n                    return true;\n                }\n            }\n            else\n            {\n                _buildType[binder.Name] = null;\n                return true;\n            }\n\t\t\treturn false;\n\t\t}\n\n        /// <summary>\n        /// Tries the invoke member.\n        /// </summary>\n        /// <param name=\"binder\">The binder.</param>\n        /// <param name=\"args\">The args.</param>\n        /// <param name=\"result\">The result.</param>\n        /// <returns></returns>\n        public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result)\n        {\n            if(!_buildType.TryGetValue(binder.Name, out var tBuildType))\n                tBuildType = null;\n\n            if (tBuildType == null && !_buildType.TryGetValue(\"Object\", out tBuildType))\n                tBuildType = null;\n\n            result = InvokeHelper(binder.CallInfo, args,tBuildType);\n            if (TryTypeForName(binder.Name, out var tType))\n            {\n                var typeInfo = tType.GetTypeInfo();\n                if (Dynamic.Impromptu.IsAvailable && typeInfo.IsInterface && result != null && !typeInfo.IsAssignableFrom(result.GetType()))\n                {\n                   result = Dynamic.Impromptu.DynamicActLike(result, tType);\n                }\n            }\n            return true;\n\n        }\n\n        private static object InvokeHelper(CallInfo callinfo, IList<object> args, Activate buildType =null)\n        {\n           \n            bool tSetWithName = true;\n            object tArg = null;\n            if (callinfo.ArgumentNames.Count == 0 && callinfo.ArgumentCount == 1)\n            {\n                tArg =args[0];\n                \n                if (Util.IsAnonymousType(tArg) || tArg is IEnumerable<KeyValuePair<string, object>>)\n                {\n                    tSetWithName = false;\n                }\n            }\n\n            if (tSetWithName && callinfo.ArgumentNames.Count != callinfo.ArgumentCount)\n                throw new ArgumentException(\"Requires argument names for every argument\");\n            object result;\n            if (buildType != null)\n            {\n                result = buildType.Create();\n            }\n            else{\n                try\n                {\n                    result = Activator.CreateInstance<TObjectProtoType>();//Try first because faster but doens't work with optional parameters\n                }\n                catch (Exception)\n                {\n                    result = Dynamic.InvokeConstructor(typeof (TObjectProtoType));\n                }\n\n            }\n            if(tSetWithName)\n            {\n                tArg = callinfo.ArgumentNames.Zip(args, (n, a) => new KeyValuePair<string, object>(n, a));\n            }\n\n            return Dynamic.InvokeSetAll(result, tArg);\n        }\n    }\n}\n"
  },
  {
    "path": "Dynamitey/DynamicObjects/Dictionary.cs",
    "content": "﻿ // \n//  Copyright 2010  Ekon Benefits\n// \n//    Licensed under the Apache License, Version 2.0 (the \"License\");\n//    you may not use this file except in compliance with the License.\n//    You may obtain a copy of the License at\n// \n//        http://www.apache.org/licenses/LICENSE-2.0\n// \n//    Unless required by applicable law or agreed to in writing, software\n//    distributed under the License is distributed on an \"AS IS\" BASIS,\n//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//    See the License for the specific language governing permissions and\n//    limitations under the License.\n\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Dynamic;\nusing System.Linq;\nusing System.Reflection;\n\n\nnamespace Dynamitey.DynamicObjects\n{\n    /// <summary>\n    /// Similar to Expando Objects but handles null values when the property is defined with an impromptu interface\n    /// </summary>\n    public class Dictionary:BaseDictionary,IDictionary<string,object>\n    {\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"Dictionary\"/> class.\n        /// </summary>\n        public Dictionary() \n        {\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"Dictionary\"/> class.\n        /// </summary>\n        /// <param name=\"dict\">The dict.</param>\n        public Dictionary(IEnumerable<KeyValuePair<string, object>> dict) : base(dict)\n        {\n        }\n\n\n        /// <summary>\n        /// Gets the count.\n        /// </summary>\n        /// <value>The count.</value>\n        public int Count => _dictionary.Count;\n\n\n        /// <summary>\n        /// Gets the enumerator.\n        /// </summary>\n        /// <returns></returns>\n        public IEnumerator<KeyValuePair<string, object>> GetEnumerator()\n        {\n           return _dictionary.GetEnumerator();\n        }\n\n        IEnumerator IEnumerable.GetEnumerator()\n        {\n            return GetEnumerator();\n        }\n\n        /// <summary>\n        /// Clears this instance.\n        /// </summary>\n        public void Clear()\n        {\n            var tKeys = Keys;\n           \n\n            _dictionary.Clear();\n\n            foreach (var tKey in tKeys)\n            {\n                OnPropertyChanged(tKey);\n            }\n        }\n\n        /// <summary>\n        /// Gets or sets the <see cref=\"System.Object\"/> with the specified key.\n        /// </summary>\n        /// <value></value>\n        public object this[string key]\n        {\n            get => _dictionary[key];\n            set => SetProperty(key, value);\n        }\n    }\n\n\n    /// <summary>\n    /// Adds extra synatx to intialize properties to match up with clay\n    /// </summary>\n\tpublic class ChainableDictionary:Dictionary{\n\n\n            /// <summary>\n            /// Initializes a new instance of the <see cref=\"ChainableDictionary\"/> class.\n            /// </summary>\n        public ChainableDictionary() \n        {\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"Dictionary\"/> class.\n        /// </summary>\n        /// <param name=\"dict\">The dict.</param>\n        public ChainableDictionary(IEnumerable<KeyValuePair<string, object>> dict) : base(dict)\n        {\n        }\n\n\n        /// <summary>\n        /// Provides the implementation for operations that invoke a member. Classes derived from the <see cref=\"T:System.Dynamic.DynamicObject\" /> class can override this method to specify dynamic behavior for operations such as calling a method.\n        /// </summary>\n        /// <param name=\"binder\">Provides information about the dynamic operation. The binder.Name property provides the name of the member on which the dynamic operation is performed. For example, for the statement sampleObject.SampleMethod(100), where sampleObject is an instance of the class derived from the <see cref=\"T:System.Dynamic.DynamicObject\" /> class, binder.Name returns \"SampleMethod\". The binder.IgnoreCase property specifies whether the member name is case-sensitive.</param>\n        /// <param name=\"args\">The arguments that are passed to the object member during the invoke operation. For example, for the statement sampleObject.SampleMethod(100), where sampleObject is derived from the <see cref=\"T:System.Dynamic.DynamicObject\" /> class, <paramref name=\"args\" /> is equal to 100.</param>\n        /// <param name=\"result\">The result of the member invocation.</param>\n        /// <returns>\n        /// true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.)\n        /// </returns>\n\t\tpublic override bool TryInvokeMember (InvokeMemberBinder binder, object[] args, out object result)\n\t\t{\n\t\t\tif(base.TryInvokeMember (binder, args, out result)){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif(binder.CallInfo.ArgumentCount ==1){\n\t\t\t\t\tSetProperty(binder.Name, args.FirstOrDefault());\n\t\t\t\tresult = this;\n\t\t\t\treturn true;\n\t\t\t}\n            if (binder.CallInfo.ArgumentCount > 1)\n            {\n                SetProperty(binder.Name,new List(args));\n                result = this;\n                return true;\n            }\n\t\t\t\t\n\t\t\treturn false;\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "Dynamitey/DynamicObjects/Dummy.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing Dynamitey.Internal.Optimization;\n\n\nnamespace Dynamitey.DynamicObjects\n{\n    /// <summary>\n    /// Dummy that just returns null or default for everything.\n    /// </summary>\n   \n    public class Dummy:BaseObject\n    {\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"Dummy\"/> class.\n        /// </summary>\n        public Dummy()\n        {\n            \n        }\n\n\n\n\n        /// <summary>\n        /// Provides the implementation for operations that get member values. Classes derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class can override this method to specify dynamic behavior for operations such as getting a value for a property.\n        /// </summary>\n        /// <param name=\"binder\">Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member on which the dynamic operation is performed. For example, for the Console.WriteLine(sampleObject.SampleProperty) statement, where sampleObject is an instance of the class derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class, binder.Name returns \"SampleProperty\". The binder.IgnoreCase property specifies whether the member name is case-sensitive.</param>\n        /// <param name=\"result\">The result of the get operation. For example, if the method is called for a property, you can assign the property value to <paramref name=\"result\"/>.</param>\n        /// <returns>\n        /// true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a run-time exception is thrown.)\n        /// </returns>\n        public override bool TryGetMember(System.Dynamic.GetMemberBinder binder, out object result)\n        {\n            result = null;\n            return this.MassageResultBasedOnInterface(binder.Name, true, ref result);\n          \n        }\n\n        /// <summary>\n        /// Provides the implementation for operations that set member values. Classes derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class can override this method to specify dynamic behavior for operations such as setting a value for a property.\n        /// </summary>\n        /// <param name=\"binder\">Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member to which the value is being assigned. For example, for the statement sampleObject.SampleProperty = \"Test\", where sampleObject is an instance of the class derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class, binder.Name returns \"SampleProperty\". The binder.IgnoreCase property specifies whether the member name is case-sensitive.</param>\n        /// <param name=\"value\">The value to set to the member. For example, for sampleObject.SampleProperty = \"Test\", where sampleObject is an instance of the class derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class, the <paramref name=\"value\"/> is \"Test\".</param>\n        /// <returns>\n        /// true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.)\n        /// </returns>\n        public override bool TrySetMember(System.Dynamic.SetMemberBinder binder, object value)\n        {\n            return true;\n        }\n\n\n        /// <summary>\n        /// Provides the implementation for operations that invoke a member. Classes derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class can override this method to specify dynamic behavior for operations such as calling a method.\n        /// </summary>\n        /// <param name=\"binder\">Provides information about the dynamic operation. The binder.Name property provides the name of the member on which the dynamic operation is performed. For example, for the statement sampleObject.SampleMethod(100), where sampleObject is an instance of the class derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class, binder.Name returns \"SampleMethod\". The binder.IgnoreCase property specifies whether the member name is case-sensitive.</param>\n        /// <param name=\"args\">The arguments that are passed to the object member during the invoke operation. For example, for the statement sampleObject.SampleMethod(100), where sampleObject is derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class, <paramref name=\"args\"/> is equal to 100.</param>\n        /// <param name=\"result\">The result of the member invocation.</param>\n        /// <returns>\n        /// true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.)\n        /// </returns>\n        public override bool TryInvokeMember(System.Dynamic.InvokeMemberBinder binder, object[] args, out object result)\n        {\n\n            result = null;\n            return this.MassageResultBasedOnInterface(binder.Name, true, ref result);\n        }\n\n      \n\n        /// <summary>\n        /// Tries the index of the get.\n        /// </summary>\n        /// <param name=\"binder\">The binder.</param>\n        /// <param name=\"indexes\">The indexes.</param>\n        /// <param name=\"result\">The result.</param>\n        /// <returns></returns>\n        public override bool TryGetIndex(System.Dynamic.GetIndexBinder binder, object[] indexes, out object result)\n        {\n            result = null;\n            return this.MassageResultBasedOnInterface(Invocation.IndexBinderName, true, ref result);\n        \n        }\n\n        /// <summary>\n        /// Tries the index of the set.\n        /// </summary>\n        /// <param name=\"binder\">The binder.</param>\n        /// <param name=\"indexes\">The indexes.</param>\n        /// <param name=\"value\">The value.</param>\n        /// <returns></returns>\n        public override bool TrySetIndex(System.Dynamic.SetIndexBinder binder, object[] indexes, object value)\n        {\n            return true;\n        }\n    }\n}\n"
  },
  {
    "path": "Dynamitey/DynamicObjects/ExtensionToInstanceProxy.cs",
    "content": "﻿using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Dynamic;\nusing System.Linq;\nusing System.Reflection;\n\nusing System.Text;\nusing Microsoft.CSharp.RuntimeBinder;\nusing Dynamitey.Internal.Compat;\nusing Dynamitey.Internal.Optimization;\n\nnamespace Dynamitey.DynamicObjects\n{\n\n\n    /// <summary>\n    /// Proxy that can turn extension methods into instance methods \n    /// </summary>\n    public class ExtensionToInstanceProxy: BaseForwarder\n    {\n       \n        private readonly Type _extendedType;\n       \n        private readonly Type[] _staticTypes;\n       \n        private readonly Type[] _instanceHints;\n\n        /// <summary>\n        /// Gets the instance hints.\n        /// </summary>\n        /// <value>\n        /// The instance hints.\n        /// </value>\n        public IEnumerable<Type> InstanceHints => _instanceHints;\n\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"ExtensionToInstanceProxy\" /> class.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <param name=\"extendedType\">Type of the extended.</param>\n        /// <param name=\"staticTypes\">The static types.</param>\n        /// <param name=\"instanceHints\">The instance hints.</param>\n        /// <exception cref=\"System.ArgumentException\">Don't Nest ExtensionToInstance Objects</exception>\n        public ExtensionToInstanceProxy(dynamic target,  Type extendedType, Type[] staticTypes, Type[] instanceHints = null):base((object)target)\n        {\n            _staticTypes = staticTypes;\n            _extendedType = extendedType;\n            _instanceHints = instanceHints;\n\n            if(target is ExtensionToInstanceProxy)\n                throw new ArgumentException(\"Don't Nest ExtensionToInstance Objects\");\n\n            if (IsExtendedType(target) || IsExtendedType(Util.GetTargetContext(target,out Type _, out bool _)))\n            {\n                return;\n            }\n\n            throw new ArgumentException($\"Non a valid {_extendedType} to be wrapped.\");\n            \n        }\n\n        private object UnwrappedTarget(){\n            return Util.GetTargetContext(CallTarget, out Type _, out bool _);\n        }\n\n        /// <summary>\n        /// Provides the implementation for operations that get member values. Classes derived from the <see cref=\"T:System.Dynamic.DynamicObject\" /> class can override this method to specify dynamic behavior for operations such as getting a value for a property.\n        /// </summary>\n        /// <param name=\"binder\">Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member on which the dynamic operation is performed. For example, for the Console.WriteLine(sampleObject.SampleProperty) statement, where sampleObject is an instance of the class derived from the <see cref=\"T:System.Dynamic.DynamicObject\" /> class, binder.Name returns \"SampleProperty\". The binder.IgnoreCase property specifies whether the member name is case-sensitive.</param>\n        /// <param name=\"result\">The result of the get operation. For example, if the method is called for a property, you can assign the property value to <paramref name=\"result\" />.</param>\n        /// <returns>\n        /// true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a run-time exception is thrown.)\n        /// </returns>\n        public override bool TryGetMember(GetMemberBinder binder, out object result)\n        {\n\n            if (!base.TryGetMember(binder, out result))\n            {\n\n                var tInterface = UnwrappedTarget().GetType().GetTypeInfo().GetInterfaces().Single(it => it.Name == _extendedType.Name);\n                var typeInfo = tInterface.GetTypeInfo();\n                result = new Invoker(binder.Name,\n                                     typeInfo.IsGenericType ? typeInfo.GetGenericArguments() : new Type[] {},null, this);\n            }\n            return true;\n        }\n\n        /// <summary>\n        /// Basic Invoker syntax for dynamic generics\n        /// </summary>\n        public class Invoker:BaseObject\n        {\n            /// <summary>\n            /// The name\n            /// </summary>\n            protected string Name;\n            /// <summary>\n            /// The parent\n            /// </summary>\n            protected ExtensionToInstanceProxy Parent;\n            /// <summary>\n            /// The overload types\n            /// </summary>\n            protected IDictionary<int, Type[]> OverloadTypes;\n            /// <summary>\n            /// The generic params\n            /// </summary>\n            protected Type[] GenericParams;\n            /// <summary>\n            /// The generic method parameters\n            /// </summary>\n            protected Type[] GenericMethodParameters;\n\n            internal Invoker(string name, Type[] genericParameters, Type[] genericMethodParameters, ExtensionToInstanceProxy parent, Type[] overloadTypes = null)\n            {\n                Name = name;\n                Parent = parent;\n                GenericParams = genericParameters;\n                GenericMethodParameters = genericMethodParameters;\n                OverloadTypes = new Dictionary<int,Type[]>();\n\n                if (overloadTypes == null)\n                {\n\n                    foreach (var tGenInterface in parent.InstanceHints)\n                    {\n                        var tNewType = tGenInterface;\n\n                        if (tNewType.GetTypeInfo().IsGenericType)\n                        {\n                            tNewType = tNewType.MakeGenericType(GenericParams);\n                        }\n\n                        var members = tNewType.GetTypeInfo().GetMethods(BindingFlags.Instance |\n                                                                                   BindingFlags.Public).Where(\n                                                                                       it => it.Name == Name).ToList();\n                        foreach (var tMethodInfo in members)\n                        {\n                            var tParams = tMethodInfo.GetParameters().Select(it => it.ParameterType).ToArray();\n\n                            if (OverloadTypes.ContainsKey(tParams.Length))\n                            {\n                                OverloadTypes[tParams.Length] = new Type[] {};\n                            }\n                            else\n                            {\n                                OverloadTypes[tParams.Length] = tParams.Select(ReplaceGenericTypes).ToArray();\n                            }\n                        }\n\n                        foreach (var tOverloadType in OverloadTypes.ToList())\n                        {\n                            if (tOverloadType.Value.Length == 0)\n                            {\n                                OverloadTypes.Remove(tOverloadType);\n                            }\n                        }\n\n                    }\n                }\n                else\n                    {\n                        OverloadTypes[overloadTypes.Length] = overloadTypes;\n                    }\n            }\n\n            private Type ReplaceGenericTypes(Type type)\n            {\n                var typeInfo = type.GetTypeInfo();\n                if (typeInfo.IsGenericType && typeInfo.ContainsGenericParameters)\n                {\n                    var tArgs = typeInfo.GetGenericArguments();\n\n                    tArgs = tArgs.Select(ReplaceGenericTypes).ToArray();\n\n                    return type.GetGenericTypeDefinition().MakeGenericType(tArgs);\n                }\n\n                if (typeInfo.ContainsGenericParameters)\n                {\n                    return typeof (object);\n                }\n               \n                return type;\n            }\n\n            /// <summary>\n            /// Tries the get member.\n            /// </summary>\n            /// <param name=\"binder\">The binder.</param>\n            /// <param name=\"result\">The result.</param>\n            /// <returns></returns>\n            public override bool TryGetMember(GetMemberBinder binder, out object result)\n            {\n                if (binder.Name == \"Overloads\")\n                {\n                    result = new OverloadInvoker(Name, GenericParams,GenericMethodParameters, Parent);\n                    return true;\n                }\n                return base.TryGetMember(binder, out result);\n            }\n\n\n\n            /// <summary>\n            /// Tries the invoke.\n            /// </summary>\n            /// <param name=\"binder\">The binder.</param>\n            /// <param name=\"args\">The args.</param>\n            /// <param name=\"result\">The result.</param>\n            /// <returns></returns>\n            public override bool TryInvoke(InvokeBinder binder, object[] args, out object result)\n            {\n                object[] tArgs = args;\n                if (OverloadTypes.ContainsKey(args.Length))\n                {\n                    tArgs = OverloadTypes[args.Length].Zip(args, Tuple.Create)\n                        .Select(it => it.Item2 != null ? Dynamic.InvokeConvert(it.Item2, it.Item1, @explicit: true) : null).ToArray();\n                    \n                }\n\n                var name = InvokeMemberName.Create(Name, GenericMethodParameters);\n\n                result = Parent.InvokeStaticMethod(name, tArgs);\n                return true;\n            }\n\n            /// <summary>\n            /// Tries the index of the get.\n            /// </summary>\n            /// <param name=\"binder\">The binder.</param>\n            /// <param name=\"indexes\">The indexes.</param>\n            /// <param name=\"result\">The result.</param>\n            /// <returns></returns>\n            public override bool TryGetIndex(GetIndexBinder binder, object[] indexes, out object result)\n            {\n                result = new Invoker(Name, GenericParams, indexes.Select(it => Dynamic.InvokeConvert(it, typeof(Type), @explicit: true)).Cast<Type>().ToArray(), Parent);\n                return true;\n            }\n        }\n\n        /// <summary>\n        /// Overload Invoker\n        /// </summary>\n        public class OverloadInvoker:Invoker\n        {\n            internal OverloadInvoker(string name, Type[] genericParameters, Type[] genericMethodParameters, ExtensionToInstanceProxy parent)\n                : base(name, genericParameters,genericMethodParameters, parent)\n            {\n            }\n\n\n            /// <summary>\n            /// Tries the index of the get.\n            /// </summary>\n            /// <param name=\"binder\">The binder.</param>\n            /// <param name=\"indexes\">The indexes.</param>\n            /// <param name=\"result\">The result.</param>\n            /// <returns></returns>\n            public override bool TryGetIndex(GetIndexBinder binder, object[] indexes, out object result)\n            {\n                result = new Invoker(Name, GenericParams, GenericMethodParameters, Parent, indexes.Select(it => Dynamic.InvokeConvert(it, typeof(Type), @explicit: true)).Cast<Type>().ToArray());\n                return true;\n            }\n        }\n\n\n        /// <summary>\n        /// Tries the invoke member.\n        /// </summary>\n        /// <param name=\"binder\">The binder.</param>\n        /// <param name=\"args\">The args.</param>\n        /// <param name=\"result\">The result.</param>\n        /// <returns></returns>\n        public override bool TryInvokeMember(System.Dynamic.InvokeMemberBinder binder, object[] args, out object result)\n        {\n            if (!base.TryInvokeMember(binder, args, out result))\n            {\n\n                Type[] types = null;\n                try\n                {\n                    IList<Type> typeList =Dynamic.InvokeGet(binder,\n                                           \"Microsoft.CSharp.RuntimeBinder.ICSharpInvokeOrInvokeMemberBinder.TypeArguments\");\n                    if(typeList != null)\n                    {\n\n                        types = typeList.ToArray();\n                        \n                    }\n\n                }catch(RuntimeBinderException)\n                {\n                    try\n                    {\n                        IList<Type> typeList = Dynamic.InvokeGet(binder,\n                            \"TypeArguments\");\n                        if (typeList != null)\n                        {\n\n                            types = typeList.ToArray();\n\n                        }\n\n                    }\n                    catch (RuntimeBinderException)\n                    {\n                        types = null;\n                    }\n                }\n\n                var name=InvokeMemberName.Create;\n                result = InvokeStaticMethod(name(binder.Name, types), args);\n            }\n            return true;\n        }\n\n        /// <summary>\n        /// Invokes the static method.\n        /// </summary>\n        /// <param name=\"name\">The name.</param>\n        /// <param name=\"args\">The args.</param>\n        /// <returns></returns>\n        protected object InvokeStaticMethod(String_OR_InvokeMemberName name, object[] args)\n        {\n            var staticType = InvokeContext.CreateStatic;\n            var nameArgs = InvokeMemberName.Create;\n\n            var tList = new List<object> { UnwrappedTarget() };\n            tList.AddRange(args);\n\n            object result =null;\n            var sucess = false;\n            var exceptionList = new List<Exception>();\n\n            var tGenericPossibles = new List<Type[]>();\n            if (name.GenericArgs != null && name.GenericArgs.Length > 0)\n            {\n                var tInterface = UnwrappedTarget().GetType().GetTypeInfo().GetInterfaces().Single(it => it.Name == _extendedType.Name);\n                var tTypeGenerics = (tInterface.GetTypeInfo().IsGenericType ? tInterface.GetTypeInfo().GetGenericArguments()\n                                            : new Type[] { }).Concat(name.GenericArgs).ToArray();\n\n                tGenericPossibles.Add(tTypeGenerics);\n                tGenericPossibles.Add(name.GenericArgs);\n            }\n            else\n            {\n                tGenericPossibles.Add(null);\n            }\n                      \n\n\n            foreach (var sType in _staticTypes)\n            {\n                foreach (var tGenericPossible in tGenericPossibles)\n                {\n                    try\n                    {\n                        result = Dynamic.InvokeMember(staticType(sType), nameArgs(name.Name, tGenericPossible), tList.ToArray());\n                        sucess = true;\n                        break;\n                    }\n                    catch (RuntimeBinderException ex)\n                    {\n                        exceptionList.Add(ex);\n                    }\n                }\n                if(sucess){\n                    break;\n                }\n            }\n\n            if (!sucess)\n            {\n                throw exceptionList.First();\n            }\n\n\n            if (TryTypeForName(name.Name, out var tOutType))\n            {\n                var outTypeInfo = tOutType.GetTypeInfo();\n                if (outTypeInfo.IsInterface)\n                {\n                    var tIsGeneric = outTypeInfo.IsGenericType;\n                    if (outTypeInfo.IsGenericType)\n                    {\n                        tOutType = tOutType.GetGenericTypeDefinition();\n                    }\n\n                    if (InstanceHints.Select(it => tIsGeneric && it.GetTypeInfo().IsGenericType ? it.GetGenericTypeDefinition() : it)\n                            .Any(it=> it.Name == tOutType.Name))\n                    { \n                        result = CreateSelf(result, _extendedType, _staticTypes, _instanceHints);\n                    }\n                }\n            }\n            else\n            {\n                if (IsExtendedType(result))\n                {\n                    result = CreateSelf(result, _extendedType, _staticTypes, _instanceHints);\n                }\n            }\n\n            return result;\n        }\n\n        /// <summary>\n        /// Creates the self.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <param name=\"extendedType\">Type of the extended.</param>\n        /// <param name=\"staticTypes\">The static types.</param>\n        /// <param name=\"instanceHints\">The instance hints.</param>\n        /// <returns></returns>\n        protected virtual ExtensionToInstanceProxy CreateSelf(object target, Type extendedType, Type[] staticTypes, Type[] instanceHints)\n        {\n            return  new ExtensionToInstanceProxy(target,extendedType,staticTypes, instanceHints);\n        }\n\n        private bool IsExtendedType(object target)\n        {\n\n            if (target is ExtensionToInstanceProxy)\n            {\n                return false;\n            }\n\n            bool genericDef = _extendedType.GetTypeInfo().IsGenericTypeDefinition;\n\n            return target.GetType().GetTypeInfo().GetInterfaces().Any(\n                it => ((genericDef && it.GetTypeInfo().IsGenericType) ? it.GetGenericTypeDefinition() : it).Name == _extendedType.Name);\n\n        }\n\n        \n    }\n}\n"
  },
  {
    "path": "Dynamitey/DynamicObjects/Factory.cs",
    "content": "﻿// \n//  Copyright 2010  Ekon Benefits\n// \n//    Licensed under the Apache License, Version 2.0 (the \"License\");\n//    you may not use this file except in compliance with the License.\n//    You may obtain a copy of the License at\n// \n//        http://www.apache.org/licenses/LICENSE-2.0\n// \n//    Unless required by applicable law or agreed to in writing, software\n//    distributed under the License is distributed on an \"AS IS\" BASIS,\n//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//    See the License for the specific language governing permissions and\n//    limitations under the License.\n\nusing System;\nusing System.Collections.Generic;\n\n\nnamespace Dynamitey.DynamicObjects\n{\n    /// <summary>\n    /// Base Class for making a fluent factory using an Impromptu Interface return type.\n    /// </summary>\n   \n   \n    public class BaseFactory:BaseObject\n    {\n  \n\n        /// <summary>\n        /// Provides the default implementation for operations that get instance as defined by <see cref=\"GetInstanceForDynamicMember\"/>. Classes derived from the <see cref=\"T:ImpromptuInterface.ImpromptuObject\"/> class can override this method to specify dynamic behavior for operations such as getting a value for a property.\n        /// </summary>\n        /// <param name=\"binder\">Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member on which the dynamic operation is performed. For example, for the Console.WriteLine(sampleObject.SampleProperty) statement, where sampleObject is an instance of the class derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class, binder.Name returns \"SampleProperty\". The binder.IgnoreCase property specifies whether the member name is case-sensitive.</param>\n        /// <param name=\"result\">The result of the get operation. For example, if the method is called for a property, you can assign the property value to <paramref name=\"result\"/>.</param>\n        /// <returns>\n        /// true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a run-time exception is thrown.)\n        /// </returns>\n        public override bool TryGetMember(System.Dynamic.GetMemberBinder binder, out object result)\n        {\n            result = GetInstanceForDynamicMember(binder.Name);\n            return result != null;\n        }\n\n        /// <summary>\n        /// Provides the implementation for operations that invoke a member. Classes derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class can override this method to specify dynamic behavior for operations such as calling a method.\n        /// </summary>\n        /// <param name=\"binder\">Provides information about the dynamic operation. The binder.Name property provides the name of the member on which the dynamic operation is performed. For example, for the statement sampleObject.SampleMethod(100), where sampleObject is an instance of the class derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class, binder.Name returns \"SampleMethod\". The binder.IgnoreCase property specifies whether the member name is case-sensitive.</param>\n        /// <param name=\"args\">The arguments that are passed to the object member during the invoke operation. For example, for the statement sampleObject.SampleMethod(100), where sampleObject is derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class, <paramref name=\"args\"/>[0] is equal to 100.</param>\n        /// <param name=\"result\">The result of the member invocation.</param>\n        /// <returns>\n        /// true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.)\n        /// </returns>\n        public override bool TryInvokeMember(System.Dynamic.InvokeMemberBinder binder, object[] args, out object result)\n        {\n            result = GetInstanceForDynamicMember(binder.Name, args);\n            return result != null;\n        }\n\n\n        /// <summary>\n        /// Constructs the type. Override for changing type intialization property changes.\n        /// </summary>\n        /// <param name=\"type\">The type.</param>\n        /// <param name=\"args\">The args.</param>\n        /// <returns></returns>\n        protected virtual object CreateType(Type type, params object[] args)\n        {\n            return Dynamic.InvokeConstructor(type, args);\n        }\n\n        /// <summary>\n        /// Gets the instance for a dynamic member. Override for type constrcution behavoir changes based on property name.\n        /// </summary>\n        /// <param name=\"memberName\">Name of the member.</param>\n        /// <param name=\"args\">The args.</param>\n        /// <returns></returns>\n        protected virtual object GetInstanceForDynamicMember(string memberName, params object[] args)\n        {\n            return TryTypeForName(memberName, out var type) ? CreateType(type, args) : null;\n        }\n    }\n\n\n    /// <summary>\n    /// Base Class for making a singleton fluent factory using an Impromptu Interface return type.\n    /// </summary>\n     \n   \n    public class BaseSingleInstancesFactory : BaseFactory\n    { \n        \n   \n        /// <summary>\n        /// Store Singletons\n        /// </summary>\n       \n        protected readonly Dictionary<string, dynamic> _hashFactoryTypes= new Dictionary<string, dynamic>();\n\n        /// <summary>\n        /// Lock for accessing singletons\n        /// </summary>\n        protected readonly object _lockTable = new object();\n\n\n        /// <summary>\n        /// Gets the instance for a dynamic member. Override for type constrcution behavoir changes based on property name.\n        /// </summary>\n        /// <param name=\"memberName\">Name of the member.</param>\n        /// <param name=\"args\"></param>\n        /// <returns></returns>\n        protected override object GetInstanceForDynamicMember(string memberName, params object[] args)\n        {\n            lock (_lockTable)\n            {\n                if (!_hashFactoryTypes.ContainsKey(memberName))\n                {\n                    if (TryTypeForName(memberName, out var type))\n                    {\n                        _hashFactoryTypes.Add(memberName, CreateType(type, args));\n                    }\n                    else\n                    {\n                        return null;\n                    }\n\n                }\n\n                return _hashFactoryTypes[memberName];\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "Dynamitey/DynamicObjects/FauxType.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Reflection;\nusing Dynamitey.Internal.Compat;\n\nnamespace Dynamitey.DynamicObjects\n{\n\n\n    /// <summary>\n    /// A Fake Type\n    /// </summary>\n    public abstract class FauxType\n    {\n        /// <summary>\n        /// Fauxes the type.\n        /// </summary>\n        /// <param name=\"type\">The type.</param>\n        /// <returns></returns>\n        public static implicit operator FauxType(Type type)\n        {\n            return new RealType(type);\n        }\n\n\n        /// <summary>\n        /// Gets the members.\n        /// </summary>\n        /// <param name=\"binderName\">Name of the binder.</param>\n        /// <returns></returns>\n        public abstract IEnumerable<MemberInfo> GetMember(string binderName);\n\n        /// <summary>\n        /// Gets the contained types.\n        /// </summary>\n        /// <returns></returns>\n        public abstract Type[] GetContainedTypes();\n\n        public abstract IEnumerable<string> GetMemberNames();\n\n        /// <summary>\n        /// Determines whether the specified type contains the type.\n        /// </summary>\n        /// <param name=\"type\">The type.</param>\n        /// <returns>\n        ///   <c>true</c> if the specified type contains type; otherwise, <c>false</c>.\n        /// </returns>\n        public virtual bool ContainsType(Type type)\n        {\n            return GetContainedTypes().Contains(type);\n        }\n\n    }\n\n\n\n    public class PropretySpecType : FauxType\n    {\n        public IDictionary<string, Type> PropertySpec { get; }\n\n        public PropretySpecType(IDictionary<string, Type> propertySpec)\n        {\n            PropertySpec = propertySpec;\n        }\n\n        public override IEnumerable<MemberInfo> GetMember(string binderName)\n        {\n            if (PropertySpec.TryGetValue(binderName, out var val))\n            {\n                return new[] {val.GetTypeInfo()};\n\n            }\n            return Enumerable.Empty<MemberInfo>();\n        }\n\n        public override IEnumerable<string> GetMemberNames()\n        {\n            return PropertySpec.Keys;\n        }\n\n        public override Type[] GetContainedTypes()\n        {\n            return new Type []{};\n        }\n    }\n\n\n    /// <summary>\n    /// A Fake Type that represents a real type\n    /// </summary>\n    public class RealType : FauxType\n    {\n        /// <summary>\n        /// RealType implicitly conversts to an actualy Type\n        /// </summary>\n        /// <param name=\"type\">The type.</param>\n        /// <returns></returns>\n         public static implicit operator Type(RealType type)\n         {\n             return type.TargetType;\n         }\n\n         /// <summary>\n         /// An actual Type implicitly conversts to a real type\n         /// </summary>\n         /// <param name=\"type\">The type.</param>\n         /// <returns></returns>\n         public static implicit operator RealType(Type type)\n         {\n             return new RealType(type);\n         }\n\n\n         /// <summary>\n         /// The target type\n         /// </summary>\n        protected readonly Type TargetType;\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"RealType\" /> class.\n        /// </summary>\n        /// <param name=\"type\">The type.</param>\n        public RealType(Type type)\n        {\n            TargetType = type;\n        }\n\n        /// <summary>\n        /// Gets the members.\n        /// </summary>\n        /// <param name=\"binderName\">Name of the binder.</param>\n        /// <returns></returns>\n        public override IEnumerable<MemberInfo> GetMember(string binderName)\n        {\n            return TargetType.GetTypeInfo().GetMember(binderName);\n        }\n\n        public override IEnumerable<string> GetMemberNames()\n        {\n      \n            var members = TargetType.GetTypeInfo()\n                .GetMembers(BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.Instance)\n                .Where(it=> !((it as MethodInfo)?.IsHideBySig ?? false))\n                .Select(it => it.Name)\n                .Distinct();\n            return members.ToList();\n        }\n\n        /// <summary>\n        /// Gets the contained types.\n        /// </summary>\n        /// <returns></returns>\n        public override Type[] GetContainedTypes()\n        {\n            return new[] { TargetType };\n        }\n\n   \n    }\n\n\n    /// <summary>\n    /// A Fake Tupe that is an aggregate of other types\n    /// </summary>\n    public class AggreType : FauxType\n    {\n\n        /// <summary>\n        /// Makes the type appendable.\n        /// </summary>\n        /// <param name=\"type\">The type.</param>\n        /// <returns></returns>\n        public static AggreType MakeTypeAppendable(IEquivalentType type)\n        {\n            if (type.EquivalentType == null)\n            {\n                type.EquivalentType = new AggreType();\n            }\n            if (!(type.EquivalentType is AggreType))\n            {\n                type.EquivalentType = new AggreType(type.EquivalentType);\n            }\n            return (AggreType) type.EquivalentType;\n        }\n\n\n       \n        private readonly List<FauxType> Types = new List<FauxType>();\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"AggreType\" /> class.\n        /// </summary>\n        /// <param name=\"types\">The types.</param>\n        public AggreType(params FauxType[] types)\n        {\n            Types.AddRange(types);\n        }\n\n        /// <summary>\n        /// Gets the interface types.\n        /// </summary>\n        /// <returns></returns>\n        public Type[] GetInterfaceTypes()\n        {\n            return Types.SelectMany(it => it.GetContainedTypes()).Where(it => it.GetTypeInfo().IsInterface).ToArray();\n        }\n\n        public override IEnumerable<string> GetMemberNames()\n        {\n            return Types.SelectMany(it => it.GetMemberNames()).Distinct();\n        }\n\n        /// <summary>\n        /// Adds the type.\n        /// </summary>\n        /// <param name=\"type\">The type.</param>\n        public void AddType(Type type)\n        {\n            if (!ContainsType(type))\n            {\n                Types.Add(type);\n            }\n        }\n\n        /// <summary>\n        /// Adds the type.\n        /// </summary>\n        /// <param name=\"type\">The type.</param>\n        public void AddType(FauxType type)\n        {\n            if (type is RealType)\n            {\n                foreach (var realType in type.GetContainedTypes())\n                {\n                    AddType(realType);\n                }\n            }else if (type is AggreType)\n            {\n                foreach (var fauxType in ((AggreType)type).Types)\n                {\n                    AddType(fauxType);\n                }\n            }\n            else\n            {\n                Types.Add(type);\n            }\n\n        }\n\n        /// <summary>\n        /// Gets the members.\n        /// </summary>\n        /// <param name=\"binderName\">Name of the binder.</param>\n        /// <returns></returns>\n        public override IEnumerable<MemberInfo> GetMember(string binderName)\n        {\n            var list = new List<MemberInfo>();\n            foreach (FauxType t in Types)\n            {\n                list.AddRange(t.GetMember(binderName));\n            }\n            return list;\n        }\n\n        /// <summary>\n        /// Gets the contained types.\n        /// </summary>\n        /// <returns></returns>\n        public override Type[] GetContainedTypes()\n        {\n            return Types.SelectMany(it => it.GetContainedTypes()).ToArray();\n        }\n    }\n}\n"
  },
  {
    "path": "Dynamitey/DynamicObjects/FluentStringLookup.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Dynamic;\nusing System.Linq;\n\nusing System.Text;\n\nusing System.Reflection;\nnamespace Dynamitey.DynamicObjects\n{\n\n\n    /// <summary>\n    /// Building block to use Method calls as dynamic lookups\n    /// </summary>\n    public class FluentStringLookup:DynamicObject\n    {\n       \n        private readonly Func<string, dynamic> _lookup;\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"FluentStringLookup\"/> class.\n        /// </summary>\n        /// <param name=\"lookup\">The lookup.</param>\n        public FluentStringLookup(Func<string,dynamic> lookup)\n        {\n            _lookup = lookup;\n        }\n\n        /// <summary>\n        /// Tries the invoke member.\n        /// </summary>\n        /// <param name=\"binder\">The binder.</param>\n        /// <param name=\"args\">The args.</param>\n        /// <param name=\"result\">The result.</param>\n        /// <returns></returns>\n        public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result)\n        {\n            result = _lookup(binder.Name);\n            return true;\n        }\n\n        /// <summary>\n        /// Tries the invoke.\n        /// </summary>\n        /// <param name=\"binder\">The binder.</param>\n        /// <param name=\"args\">The args.</param>\n        /// <param name=\"result\">The result.</param>\n        /// <returns></returns>\n        public override bool TryInvoke(InvokeBinder binder, object[] args, out object result)\n        {\n            result = null;\n            if (args.Length == 1 && args.First() is String)\n            {\n                result = _lookup(args[0] as String);\n                return true;\n            }\n            return false;\n        }\n\n\n    }\n}\n"
  },
  {
    "path": "Dynamitey/DynamicObjects/Get.cs",
    "content": "﻿// \n//  Copyright 2011 Ekon Benefits\n// \n//    Licensed under the Apache License, Version 2.0 (the \"License\");\n//    you may not use this file except in compliance with the License.\n//    You may obtain a copy of the License at\n// \n//        http://www.apache.org/licenses/LICENSE-2.0\n// \n//    Unless required by applicable law or agreed to in writing, software\n//    distributed under the License is distributed on an \"AS IS\" BASIS,\n//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//    See the License for the specific language governing permissions and\n//    limitations under the License.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Reflection;\n\nusing Dynamitey.Internal.Optimization;\nusing Microsoft.CSharp.RuntimeBinder;\n\nnamespace Dynamitey.DynamicObjects\n{\n    /// <summary>\n    /// Dynamic Proxy that exposes any properties of objects, and can massage results based on interface\n    /// </summary>\n\n   \n    public class Get:BaseForwarder\n    {\n     \n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"Get\"/> class.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        public Get(object target):base(target)\n        {\n            \n        }\n\n\n\n        /// <summary>\n        /// Creates the proxy over the specified target.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <returns></returns>\n        public static dynamic Create(object target)\n        {\n            return new Get(target);\n        }\n        /// <summary>\n        /// Provides the implementation for operations that get member values. Classes derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class can override this method to specify dynamic behavior for operations such as getting a value for a property.\n        /// </summary>\n        /// <param name=\"binder\">Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member on which the dynamic operation is performed. For example, for the Console.WriteLine(sampleObject.SampleProperty) statement, where sampleObject is an instance of the class derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class, binder.Name returns \"SampleProperty\". The binder.IgnoreCase property specifies whether the member name is case-sensitive.</param>\n        /// <param name=\"result\">The result of the get operation. For example, if the method is called for a property, you can assign the property value to <paramref name=\"result\"/>.</param>\n        /// <returns>\n        /// true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a run-time exception is thrown.)\n        /// </returns>\n        public override bool TryGetMember(System.Dynamic.GetMemberBinder binder, out object result)\n        {\n            if (base.TryGetMember(binder, out result))\n            {\n                return this.MassageResultBasedOnInterface(binder.Name, true, ref result);\n            }\n            return false;\n        }\n\n\n        /// <summary>\n        /// Provides the implementation for operations that invoke a member. Classes derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class can override this method to specify dynamic behavior for operations such as calling a method.\n        /// </summary>\n        /// <param name=\"binder\">Provides information about the dynamic operation. The binder.Name property provides the name of the member on which the dynamic operation is performed. For example, for the statement sampleObject.SampleMethod(100), where sampleObject is an instance of the class derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class, binder.Name returns \"SampleMethod\". The binder.IgnoreCase property specifies whether the member name is case-sensitive.</param>\n        /// <param name=\"args\">The arguments that are passed to the object member during the invoke operation. For example, for the statement sampleObject.SampleMethod(100), where sampleObject is derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class, <paramref name=\"args\"/> is equal to 100.</param>\n        /// <param name=\"result\">The result of the member invocation.</param>\n        /// <returns>\n        /// true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.)\n        /// </returns>\n        public override bool TryInvokeMember(System.Dynamic.InvokeMemberBinder binder, object[] args, out object result)\n        {\n\n            if (!base.TryInvokeMember(binder, args, out result))\n            {\n                try\n                {\n                    //Check if there is a get property because it might return a function\n                    result = Dynamic.InvokeGet(CallTarget, binder.Name);\n                }\n                catch (RuntimeBinderException)\n                {\n                    return false;\n                }\n                if (result == null)\n                    return false;\n                var tDel = result as Delegate;\n                if (!binder.CallInfo.ArgumentNames.Any() && tDel != null)\n                {\n                    try\n                    {\n                        result = this.InvokeMethodDelegate(tDel, args);\n                    }\n                    catch (RuntimeBinderException)\n                        //If it has out parmaters etc it can't be invoked dynamically like this.\n                        //if we return false it will be handle by the GetProperty and then handled by the original dynamic invocation \n                    {\n                        return false;\n                    }\n                }\n                try\n                {\n                    result = Dynamic.Invoke(result, Util.NameArgsIfNecessary(binder.CallInfo, args));\n                }\n                catch (RuntimeBinderException)//If it has out parmaters etc it can't be invoked dynamically like this.\n                //if we return false it will be handle by the GetProperty and then handled by the original dynamic invocation \n                {\n                    return false;\n                } \n            }\n\n            return this.MassageResultBasedOnInterface(binder.Name, true, ref result);\n        }\n\n\n        /// <summary>\n        /// Tries the index of the get.\n        /// </summary>\n        /// <param name=\"binder\">The binder.</param>\n        /// <param name=\"indexes\">The indexes.</param>\n        /// <param name=\"result\">The result.</param>\n        /// <returns></returns>\n        public override bool TryGetIndex(System.Dynamic.GetIndexBinder binder, object[] indexes, out object result)\n        {\n            if (base.TryGetIndex(binder, indexes, out result))\n            {\n                return this.MassageResultBasedOnInterface(Invocation.IndexBinderName, true, ref result);\n            }\n            return false;\n        }\n    }\n\n}\n"
  },
  {
    "path": "Dynamitey/DynamicObjects/LateType.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Dynamic;\nusing System.Linq;\nusing System.Reflection;\n\nusing System.Text;\nusing Dynamitey.Internal.Optimization;\n\n\nnamespace Dynamitey.DynamicObjects\n{\n    /// <summary>\n    /// Late bind types from libraries not not at compile type\n    /// </summary>\n    public class LateType:BaseForwarder\n    {\n\n\n        /// <summary>\n        /// Exception When The Late Type can not be found to bind.\n        /// </summary>\n        public class MissingTypeException:Exception\n        {\n            /// <summary>\n            /// Initializes a new instance of the <see cref=\"MissingTypeException\" /> class.\n            /// </summary>\n            /// <param name=\"typename\">The typename.</param>\n             public MissingTypeException(string typename)\n                 : base(String.Format(\"Could Not Find Type. {0}\", typename))\n             {\n                 \n             }\n\n             /// <summary>\n             /// Initializes a new instance of the <see cref=\"MissingTypeException\" /> class.\n             /// </summary>\n             /// <param name=\"message\">The message.</param>\n             /// <param name=\"innerException\">The inner exception.</param>\n            public MissingTypeException(string message, Exception innerException) : base(message, innerException)\n            {\n                \n            }\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"LateType\"/> class.\n        /// </summary>\n        /// <param name=\"type\">The type.</param>\n        public LateType(Type type)\n            : base(type)\n        {\n\n        }\n\n        private readonly string TypeName;\n\n\n        public static Type FindType(string typeName, Assembly assembly = null)\n        {\n            try\n            {\n                if (assembly != null)\n                {\n                    return assembly.GetType(typeName, false);\n                }\n                return Type.GetType(typeName, false);\n            }\n            catch\n            {\n                return null;\n            }\n        }\n\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"LateType\"/> class.\n        /// </summary>\n        /// <param name=\"typeName\">Qualified Name of the type.</param>\n        public LateType(string typeName)\n            : base(FindType(typeName))\n        {\n            TypeName = typeName;\n          \n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"LateType\" /> class.\n        /// </summary>\n        /// <param name=\"assembly\">The assembly.</param>\n        /// <param name=\"typeName\">Name of the type.</param>\n        public LateType(Assembly assembly, string typeName)\n            : base(FindType(typeName, assembly))\n        {\n            TypeName = typeName;\n\n        }\n\n        /// <summary>\n        /// Returns a late bound constructor\n        /// </summary>\n        /// <value>The late bound constructor</value>\n        public dynamic @new => new ConstructorForward((Type)Target);\n\n        /// <summary>\n        /// Forward argument to constructor including named arguments\n        /// </summary>\n        public class ConstructorForward:DynamicObject\n        {\n            private readonly Type _type;\n            internal ConstructorForward(Type type)\n            {\n                _type = type;\n            }\n            /// <summary>\n            /// Tries the invoke.\n            /// </summary>\n            /// <param name=\"binder\">The binder.</param>\n            /// <param name=\"args\">The args.</param>\n            /// <param name=\"result\">The result.</param>\n            /// <returns></returns>\n            public override bool TryInvoke(InvokeBinder binder, object[] args, out object result)\n            {\n                result = Dynamic.InvokeConstructor(_type, Util.NameArgsIfNecessary(binder.CallInfo, args));\n                return true;\n            }\n\n        }\n\n        /// <summary>\n        /// Gets a value indicating whether this Type is available at runtime.\n        /// </summary>\n        /// <value>\n        /// \t<c>true</c> if this instance is available; otherwise, <c>false</c>.\n        /// </value>\n        public bool IsAvailable => Target != null;\n\n\n        /// <summary>\n        /// Gets the call target.\n        /// </summary>\n        /// <value>\n        /// The call target.\n        /// </value>\n        /// <exception cref=\"Dynamitey.DynamicObjects.LateType.MissingTypeException\"></exception>\n        protected override object CallTarget\n        {\n            get\n            {\n                if(Target ==null)\n                    throw new MissingTypeException(TypeName);\n\n                return InvokeContext.CreateStatic((Type)Target);\n            }\n        }\n    \n\n\n    }\n}\n"
  },
  {
    "path": "Dynamitey/DynamicObjects/Lazy.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\n\n\nnamespace Dynamitey.DynamicObjects\n{\n\n    /// <summary>\n    /// Abstract base for the Generic class <see cref=\"Lazy{T}\"/> with <see cref=\"Create{T}(System.Func{T})\"/> fatory methods\n    /// </summary>\n   \n    public abstract class Lazy:BaseForwarder\n    {\n        /// <summary>\n        /// Creates Lazy based on the specified valuefactory.\n        /// </summary>\n        /// <typeparam name=\"T\"></typeparam>\n        /// <param name=\"valueFactory\">The value factory.</param>\n        /// <returns></returns>\n        public static dynamic Create<T>(Func<T> valueFactory)\n        {\n            return new Lazy<T>(valueFactory);\n        }\n        /// <summary>\n        /// Creates Lazy based on the specified target.\n        /// </summary>\n        /// <typeparam name=\"T\"></typeparam>\n        /// <param name=\"target\">The target.</param>\n        /// <returns></returns>\n        public static dynamic Create<T>(System.Lazy<T> target)\n        {\n            return new Lazy<T>(target);\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"Lazy\"/> class.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        protected Lazy(object target) : base(target)\n        {\n        }\n\n    }\n\n    /// <summary>\n    /// Wraps a Lazy Type evalutaes on first method call\n    /// </summary>\n    /// <typeparam name=\"T\"></typeparam>\n   \n    public class Lazy<T> : Lazy\n    {\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"Lazy{T}\"/> class.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        public Lazy(System.Lazy<T> target) : base(target)\n        {\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"Lazy{T}\"/> class.\n        /// </summary>\n        /// <param name=\"valueFactory\">The value factory.</param>\n        public Lazy(Func<T> valueFactory ):base(new System.Lazy<T>(valueFactory))\n        {\n            \n        }\n     \n\n        /// <summary>\n        /// Returns the enumeration of all dynamic member names.\n        /// </summary>\n        /// <returns>\n        /// A sequence that contains dynamic member names.\n        /// </returns>\n        public override IEnumerable<string> GetDynamicMemberNames()\n        {\n            return ((System.Lazy<T>)Target).IsValueCreated \n                ? base.GetDynamicMemberNames() \n                : Enumerable.Empty<string>();\n        }\n\n        /// <summary>\n        /// Gets the call target.\n        /// </summary>\n        /// <value>\n        /// The call target.\n        /// </value>\n        protected override object CallTarget => ((System.Lazy<T>) Target).Value;\n    }\n}\n"
  },
  {
    "path": "Dynamitey/DynamicObjects/LinqInstanceProxy.cs",
    "content": "﻿using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\n\nusing System.Text;\n\n\nnamespace Dynamitey.DynamicObjects\n{\n\n\n    /// <summary>\n    /// Extension to Intance Proxy Configured for LINQ IEnumerable methods\n    /// </summary>\n    public class LinqInstanceProxy : ExtensionToInstanceProxy, IEnumerable<object>\n    {\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"LinqInstanceProxy\" /> class.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        public LinqInstanceProxy(dynamic target)\n            :base(new InvokeContext(target, typeof(object)), typeof(IEnumerable<>), new[]{typeof(Enumerable)}, new[]{typeof(ILinq<>), typeof(IOrderedLinq<>)})\n        {\n\n        }\n\n        /// <summary>\n        /// Creates the self.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <param name=\"extendedType\">Type of the extended.</param>\n        /// <param name=\"staticTypes\">The static types.</param>\n        /// <param name=\"instanceHints\">The instance hints.</param>\n        /// <returns></returns>\n        protected override ExtensionToInstanceProxy CreateSelf(object target, Type extendedType, Type[] staticTypes, Type[] instanceHints)\n        {\n            return new LinqInstanceProxy(target);\n        }\n\n\n        /// <summary>\n        /// Gets the enumerator.\n        /// </summary>\n        /// <returns></returns>\n        public IEnumerator<object> GetEnumerator()\n        {\n            return ((dynamic) CallTarget).GetEnumerator();\n        }\n\n        IEnumerator IEnumerable.GetEnumerator()\n        {\n            return GetEnumerator();\n        }\n    }\n\n#pragma warning disable 1591\n// ReSharper disable UnusedMember.Global\n    public interface ILinq<TSource> : IEnumerable<TSource>\n    {\n        TSource Aggregate(Func<TSource, TSource, TSource> func);\n        TAccumulate Aggregate<TAccumulate>(TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> func);\n        TResult Aggregate<TAccumulate, TResult>(TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> func, Func<TAccumulate, TResult> resultSelector);\n        Boolean All(Func<TSource, Boolean> predicate);\n        Boolean Any();\n        Boolean Any(Func<TSource, Boolean> predicate);\n        ILinq<TSource> AsEnumerable();\n        Double Average(Func<TSource, Int32> selector);\n        Nullable<Double> Average(Func<TSource, Nullable<Int32>> selector);\n        Double Average(Func<TSource, Int64> selector);\n        Nullable<Double> Average(Func<TSource, Nullable<Int64>> selector);\n        Single Average(Func<TSource, Single> selector);\n        Nullable<Single> Average(Func<TSource, Nullable<Single>> selector);\n        Double Average(Func<TSource, Double> selector);\n        Nullable<Double> Average(Func<TSource, Nullable<Double>> selector);\n        Decimal Average(Func<TSource, Decimal> selector);\n        Nullable<Decimal> Average(Func<TSource, Nullable<Decimal>> selector);\n        ILinq<TResult> Cast<TResult>();\n        ILinq<TSource> Concat(IEnumerable<TSource> second);\n        Boolean Contains(TSource value);\n        Boolean Contains(TSource value, IEqualityComparer<TSource> comparer);\n        Int32 Count();\n        Int32 Count(Func<TSource, Boolean> predicate);\n        ILinq<TSource> DefaultIfEmpty();\n        ILinq<TSource> DefaultIfEmpty(TSource defaultValue);\n        ILinq<TSource> Distinct();\n        ILinq<TSource> Distinct(IEqualityComparer<TSource> comparer);\n        TSource ElementAt(Int32 index);\n        TSource ElementAtOrDefault(Int32 index);\n        ILinq<TSource> Except(IEnumerable<TSource> second);\n        ILinq<TSource> Except(IEnumerable<TSource> second, IEqualityComparer<TSource> comparer);\n        TSource First();\n        TSource First(Func<TSource, Boolean> predicate);\n        TSource FirstOrDefault();\n        TSource FirstOrDefault(Func<TSource, Boolean> predicate);\n        ILinq<IGrouping<TKey, TSource>> GroupBy<TKey>(Func<TSource, TKey> keySelector);\n        ILinq<IGrouping<TKey, TSource>> GroupBy<TKey>(Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer);\n        ILinq<IGrouping<TKey, TElement>> GroupBy<TKey, TElement>(Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector);\n        ILinq<IGrouping<TKey, TElement>> GroupBy<TKey, TElement>(Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer);\n        ILinq<TResult> GroupBy<TKey, TResult>(Func<TSource, TKey> keySelector, Func<TKey, IEnumerable<TSource>, TResult> resultSelector);\n        ILinq<TResult> GroupBy<TKey, TElement, TResult>(Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, Func<TKey, IEnumerable<TElement>, TResult> resultSelector);\n        ILinq<TResult> GroupBy<TKey, TResult>(Func<TSource, TKey> keySelector, Func<TKey, IEnumerable<TSource>, TResult> resultSelector, IEqualityComparer<TKey> comparer);\n        ILinq<TResult> GroupBy<TKey, TElement, TResult>(Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, Func<TKey, IEnumerable<TElement>, TResult> resultSelector, IEqualityComparer<TKey> comparer);\n        ILinq<TResult> GroupJoin<TInner, TKey, TResult>(IEnumerable<TInner> inner, Func<TSource, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TSource, IEnumerable<TInner>, TResult> resultSelector);\n        ILinq<TResult> GroupJoin<TInner, TKey, TResult>(IEnumerable<TInner> inner, Func<TSource, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TSource, IEnumerable<TInner>, TResult> resultSelector, IEqualityComparer<TKey> comparer);\n        ILinq<TSource> Intersect(IEnumerable<TSource> second);\n        ILinq<TSource> Intersect(IEnumerable<TSource> second, IEqualityComparer<TSource> comparer);\n        ILinq<TResult> Join<TInner, TKey, TResult>(IEnumerable<TInner> inner, Func<TSource, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TSource, TInner, TResult> resultSelector);\n        ILinq<TResult> Join<TInner, TKey, TResult>(IEnumerable<TInner> inner, Func<TSource, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TSource, TInner, TResult> resultSelector, IEqualityComparer<TKey> comparer);\n        TSource Last();\n        TSource Last(Func<TSource, Boolean> predicate);\n        TSource LastOrDefault();\n        TSource LastOrDefault(Func<TSource, Boolean> predicate);\n        Int64 LongCount();\n        Int64 LongCount(Func<TSource, Boolean> predicate);\n        TSource Max();\n        Int32 Max(Func<TSource, Int32> selector);\n        Nullable<Int32> Max(Func<TSource, Nullable<Int32>> selector);\n        Int64 Max(Func<TSource, Int64> selector);\n        Nullable<Int64> Max(Func<TSource, Nullable<Int64>> selector);\n        Single Max(Func<TSource, Single> selector);\n        Nullable<Single> Max(Func<TSource, Nullable<Single>> selector);\n        Double Max(Func<TSource, Double> selector);\n        Nullable<Double> Max(Func<TSource, Nullable<Double>> selector);\n        Decimal Max(Func<TSource, Decimal> selector);\n        Nullable<Decimal> Max(Func<TSource, Nullable<Decimal>> selector);\n        TResult Max<TResult>(Func<TSource, TResult> selector);\n        TSource Min();\n        Int32 Min(Func<TSource, Int32> selector);\n        Nullable<Int32> Min(Func<TSource, Nullable<Int32>> selector);\n        Int64 Min(Func<TSource, Int64> selector);\n        Nullable<Int64> Min(Func<TSource, Nullable<Int64>> selector);\n        Single Min(Func<TSource, Single> selector);\n        Nullable<Single> Min(Func<TSource, Nullable<Single>> selector);\n        Double Min(Func<TSource, Double> selector);\n        Nullable<Double> Min(Func<TSource, Nullable<Double>> selector);\n        Decimal Min(Func<TSource, Decimal> selector);\n        Nullable<Decimal> Min(Func<TSource, Nullable<Decimal>> selector);\n        TResult Min<TResult>(Func<TSource, TResult> selector);\n        ILinq<TResult> OfType<TResult>();\n        IOrderedLinq<TSource> OrderBy<TKey>(Func<TSource, TKey> keySelector);\n        IOrderedLinq<TSource> OrderBy<TKey>(Func<TSource, TKey> keySelector, IComparer<TKey> comparer);\n        IOrderedLinq<TSource> OrderByDescending<TKey>(Func<TSource, TKey> keySelector);\n        IOrderedLinq<TSource> OrderByDescending<TKey>(Func<TSource, TKey> keySelector, IComparer<TKey> comparer);\n        ILinq<TSource> Reverse();\n        ILinq<TResult> Select<TResult>(Func<TSource, TResult> selector);\n        ILinq<TResult> Select<TResult>(Func<TSource, Int32, TResult> selector);\n        ILinq<TResult> SelectMany<TResult>(Func<TSource, IEnumerable<TResult>> selector);\n        ILinq<TResult> SelectMany<TResult>(Func<TSource, Int32, IEnumerable<TResult>> selector);\n        ILinq<TResult> SelectMany<TCollection, TResult>(Func<TSource, Int32, IEnumerable<TCollection>> collectionSelector, Func<TSource, TCollection, TResult> resultSelector);\n        ILinq<TResult> SelectMany<TCollection, TResult>(Func<TSource, IEnumerable<TCollection>> collectionSelector, Func<TSource, TCollection, TResult> resultSelector);\n        Boolean SequenceEqual(IEnumerable<TSource> second);\n        Boolean SequenceEqual(IEnumerable<TSource> second, IEqualityComparer<TSource> comparer);\n        TSource Single();\n        TSource Single(Func<TSource, Boolean> predicate);\n        TSource SingleOrDefault();\n        TSource SingleOrDefault(Func<TSource, Boolean> predicate);\n        ILinq<TSource> Skip(Int32 count);\n        ILinq<TSource> SkipWhile(Func<TSource, Boolean> predicate);\n        ILinq<TSource> SkipWhile(Func<TSource, Int32, Boolean> predicate);\n        Int32 Sum(Func<TSource, Int32> selector);\n        Nullable<Int32> Sum(Func<TSource, Nullable<Int32>> selector);\n        Int64 Sum(Func<TSource, Int64> selector);\n        Nullable<Int64> Sum(Func<TSource, Nullable<Int64>> selector);\n        Single Sum(Func<TSource, Single> selector);\n        Nullable<Single> Sum(Func<TSource, Nullable<Single>> selector);\n        Double Sum(Func<TSource, Double> selector);\n        Nullable<Double> Sum(Func<TSource, Nullable<Double>> selector);\n        Decimal Sum(Func<TSource, Decimal> selector);\n        Nullable<Decimal> Sum(Func<TSource, Nullable<Decimal>> selector);\n        ILinq<TSource> Take(Int32 count);\n        ILinq<TSource> TakeWhile(Func<TSource, Boolean> predicate);\n        ILinq<TSource> TakeWhile(Func<TSource, Int32, Boolean> predicate);\n        TSource[] ToArray();\n        Dictionary<TKey, TSource> ToDictionary<TKey>(Func<TSource, TKey> keySelector);\n        Dictionary<TKey, TSource> ToDictionary<TKey>(Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer);\n        Dictionary<TKey, TElement> ToDictionary<TKey, TElement>(Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector);\n        Dictionary<TKey, TElement> ToDictionary<TKey, TElement>(Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer);\n        List<TSource> ToList();\n        ILookup<TKey, TSource> ToLookup<TKey>(Func<TSource, TKey> keySelector);\n        ILookup<TKey, TSource> ToLookup<TKey>(Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer);\n        ILookup<TKey, TElement> ToLookup<TKey, TElement>(Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector);\n        ILookup<TKey, TElement> ToLookup<TKey, TElement>(Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer);\n        ILinq<TSource> Union(IEnumerable<TSource> second);\n        ILinq<TSource> Union(IEnumerable<TSource> second, IEqualityComparer<TSource> comparer);\n        ILinq<TSource> Where(Func<TSource, Boolean> predicate);\n        ILinq<TSource> Where(Func<TSource, Int32, Boolean> predicate);\n        ILinq<TResult> Zip<TSecond, TResult>(IEnumerable<TSecond> second, Func<TSource, TSecond, TResult> resultSelector);\n    }\n\n    public interface IOrderedLinq<TSource> : ILinq<TSource>, IOrderedEnumerable<TSource>\n    {\n        IOrderedLinq<TSource> ThenBy<TKey>(Func<TSource, TKey> keySelector);\n        IOrderedLinq<TSource> ThenBy<TKey>(Func<TSource, TKey> keySelector, IComparer<TKey> comparer);\n        IOrderedLinq<TSource> ThenByDescending<TKey>(Func<TSource, TKey> keySelector);\n        IOrderedLinq<TSource> ThenByDescending<TKey>(Func<TSource, TKey> keySelector, IComparer<TKey> comparer);\n    }\n// ReSharper restore UnusedMember.Global\n#pragma warning restore 1591\n\n}\n"
  },
  {
    "path": "Dynamitey/DynamicObjects/List.cs",
    "content": "﻿// \n//  Copyright 2011 Ekon Benefits\n// \n//    Licensed under the Apache License, Version 2.0 (the \"License\");\n//    you may not use this file except in compliance with the License.\n//    You may obtain a copy of the License at\n// \n//        http://www.apache.org/licenses/LICENSE-2.0\n// \n//    Unless required by applicable law or agreed to in writing, software\n//    distributed under the License is distributed on an \"AS IS\" BASIS,\n//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//    See the License for the specific language governing permissions and\n//    limitations under the License.\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.ComponentModel;\nusing System.Dynamic;\nusing System.Linq;\nusing System.Linq.Expressions;\n\nusing Microsoft.CSharp.RuntimeBinder;\n\nnamespace Dynamitey.DynamicObjects\n{\n    /// <summary>\n    /// Expando-Type List for dynamic objects\n    /// </summary>\n   \n    public class List : BaseDictionary, IList<object>, IDictionary<string, object>, INotifyCollectionChanged, IList\n\n    {\n\n        /// <summary>\n        /// Wrapped list\n        /// </summary>\n       \n        protected IList<object> _list;\n\n\n        private static readonly object ListLock = new object();\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"List\"/> class.\n        /// </summary>\n        /// <param name=\"contents\">The contents.</param>\n        /// <param name=\"members\">The members.</param>\n        public List(\n            IEnumerable<object> contents =null,\n            IEnumerable<KeyValuePair<string, object>> members =null):base(members)\n        {\n            if (contents == null)\n            {\n                _list = new List<object>();\n                return;\n            }\n            if (contents is IList<object>)\n            {\n                _list = contents as IList<object>;\n            }\n            else\n            {\n                _list = contents.ToList();\n            }\n        }\n\n        IEnumerator<KeyValuePair<string, object>> IEnumerable<KeyValuePair<string, object>>.GetEnumerator()\n        {\n            return _dictionary.GetEnumerator();\n        }\n\n        /// <summary>\n        /// Gets the enumerator.\n        /// </summary>\n        /// <returns></returns>\n        public IEnumerator<dynamic> GetEnumerator()\n        {\n            return _list.GetEnumerator();\n        }\n\n\n\n        /// <summary>\n        /// Adds the specified item.\n        /// </summary>\n        /// <param name=\"item\">The item.</param>\n        public void Add(dynamic item)\n        {\n            InsertHelper(item);\n        }\n\n        /// <summary>\n        /// Clears this instance.\n        /// </summary>\n        public void Clear()\n        {\n            lock (ListLock)\n            {\n                _list.Clear();\n\n            } \n            OnCollectionChanged(NotifyCollectionChangedAction.Reset);\n        }\n\n        /// <summary>\n        /// Determines whether [contains] [the specified item].\n        /// </summary>\n        /// <param name=\"item\">The item.</param>\n        /// <returns>\n        /// \t<c>true</c> if [contains] [the specified item]; otherwise, <c>false</c>.\n        /// </returns>\n        public bool Contains(dynamic item)\n        {\n            return _list.Contains(item);\n        }\n\n        /// <summary>\n        /// Copies to.\n        /// </summary>\n        /// <param name=\"array\">The array.</param>\n        /// <param name=\"arrayIndex\">Index of the array.</param>\n        public void CopyTo(object[] array, int arrayIndex)\n        {\n            _list.CopyTo(array, arrayIndex);\n        }\n\n\n\n        /// <summary>\n        /// Gets the count.\n        /// </summary>\n        /// <value>The count.</value>\n        public int Count => _list.Count;\n\n\n        /// <summary>\n        /// Indexes the of.\n        /// </summary>\n        /// <param name=\"item\">The item.</param>\n        /// <returns></returns>\n        public int IndexOf(dynamic item)\n        {\n            lock (ListLock)\n            {\n                return _list.IndexOf(item);\n            }\n        }\n\n        /// <summary>\n        /// Inserts the specified index.\n        /// </summary>\n        /// <param name=\"index\">The index.</param>\n        /// <param name=\"item\">The item.</param>\n        public void Insert(int index, dynamic item)\n        {\n            InsertHelper(item,index);\n        }\n\n        private void InsertHelper(object item, int? index = null)\n        {\n            lock (ListLock)\n            {\n                if (!index.HasValue)\n                {\n                    index = _list.Count;\n                    _list.Add(item);\n                   \n                }\n                else\n                {\n                    _list.Insert(index.Value, item);\n                }\n            }\n            OnCollectionChanged(NotifyCollectionChangedAction.Add, newItem: item, newIndex: index);\n        }\n\n        /// <summary>\n        /// Removes at.\n        /// </summary>\n        /// <param name=\"index\">The index.</param>\n        public void RemoveAt(int index)\n        {\n            RemoveHelper(index: index);\n        }\n\n        /// <summary>\n        /// Removes the specified item.\n        /// </summary>\n        /// <param name=\"item\">The item.</param>\n        /// <returns></returns>\n        public bool Remove(dynamic item)\n        {\n            return RemoveHelper(item);\n        }\n\n        private bool RemoveHelper(object item = null, int? index = null)\n        {\n      \n            lock (ListLock)\n            {\n                if (item != null)\n                {\n                    index = _list.IndexOf(item);\n                    if (index < 0)\n                        return false;\n                }\n\n                item  = item ?? _list[index.GetValueOrDefault()];\n                _list.RemoveAt(index.GetValueOrDefault());\n            } \n            OnCollectionChanged(NotifyCollectionChangedAction.Remove, oldItem: item, oldIndex: index);\n\n            return true;\n        }\n\n        /// <summary>\n        /// Gets or sets the <see cref=\"object\" /> at the specified index.\n        /// </summary>\n        /// <value>\n        /// The <see cref=\"object\" />.\n        /// </value>\n        /// <param name=\"index\">The index.</param>\n        /// <returns></returns>\n        public dynamic this[int index]\n        {\n            get => _list[index];\n            set\n            {\n                object tOld;\n                lock (ListLock)\n                {\n                    tOld = _list[index];\n                    _list[index] = value;\n                }\n\n                OnCollectionChanged(NotifyCollectionChangedAction.Replace, tOld, value, index);\n            }\n        }\n\n        IEnumerator IEnumerable.GetEnumerator()\n        {\n            return GetEnumerator();\n        }\n\n\n        /// <summary>\n        /// Called when [collection changed].\n        /// </summary>\n        /// <param name=\"action\">The action.</param>\n        /// <param name=\"oldItem\">The old item.</param>\n        /// <param name=\"newItem\">The new item.</param>\n        /// <param name=\"oldIndex\">The old index.</param>\n        /// <param name=\"newIndex\">The new index.</param>\n        protected virtual void OnCollectionChanged(NotifyCollectionChangedAction action, object oldItem = null, object newItem = null, int? oldIndex = null, int? newIndex = null)\n\n        {\n            if (CollectionChanged != null)\n            {\n                switch (action)\n                {\n                    case NotifyCollectionChangedAction.Add:\n                        CollectionChanged(this, new NotifyCollectionChangedEventArgs(action, newItem, newIndex.GetValueOrDefault()));\n                        break;\n                    case NotifyCollectionChangedAction.Remove:\n                        CollectionChanged(this, new NotifyCollectionChangedEventArgs(action, oldItem, oldIndex.GetValueOrDefault()));\n                        break;\n                    case NotifyCollectionChangedAction.Replace:\n                        CollectionChanged(this, new NotifyCollectionChangedEventArgs(action, oldItem, newItem, oldIndex.GetValueOrDefault()));\n                        break;\n                    case NotifyCollectionChangedAction.Reset:\n                        CollectionChanged(this,new NotifyCollectionChangedEventArgs(action));\n                        break;\n                }\n            }\n\n            switch (action)\n            {\n                case NotifyCollectionChangedAction.Add:\n                    OnPropertyChanged(\"Count\");\n                    break;\n                case NotifyCollectionChangedAction.Remove:\n                    OnPropertyChanged(\"Count\");\n                    break;\n                case NotifyCollectionChangedAction.Replace:\n                    break;\n                case NotifyCollectionChangedAction.Reset:\n                    OnPropertyChanged(\"Count\");\n                    break;\n            }\n        }\n\n        /// <summary>\n        /// Occurs when the collection changes.\n        /// </summary>\n        public event NotifyCollectionChangedEventHandler CollectionChanged;\n\n        dynamic IDictionary<string, object>.this[string key]\n        {\n         \n            get => _dictionary[key];\n            set => SetProperty(key, value);\n        }\n\n        /// <summary>\n        /// Equalses the specified other.\n        /// </summary>\n        /// <param name=\"other\">The other.</param>\n        /// <returns></returns>\n        public bool Equals(List other)\n        {\n            if (ReferenceEquals(null, other)) return false;\n            if (ReferenceEquals(this, other)) return true;\n            return base.Equals(other) && Equals(other._list, _list);\n        }\n\n        /// <summary>\n        /// Determines whether the specified <see cref=\"System.Object\" /> is equal to this instance.\n        /// </summary>\n        /// <param name=\"obj\">The <see cref=\"System.Object\" /> to compare with this instance.</param>\n        /// <returns>\n        ///   <c>true</c> if the specified <see cref=\"System.Object\" /> is equal to this instance; otherwise, <c>false</c>.\n        /// </returns>\n        public override bool Equals(object obj)\n        {\n            if (ReferenceEquals(null, obj)) return false;\n            if (ReferenceEquals(this, obj)) return true;\n            return Equals(obj as List);\n        }\n\n        /// <summary>\n        /// Returns a hash code for this instance.\n        /// </summary>\n        /// <returns>\n        /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. \n        /// </returns>\n        public override int GetHashCode()\n        {\n            unchecked\n            {\n                return (base.GetHashCode()*397) ^ _list.GetHashCode();\n            }\n        }\n\n\n        /// <summary>\n        /// Gets or sets the override getting item method names. USED for GetItemProperties\n        /// </summary>\n        /// <value>The override getting item method names.</value>\n        public Func<IEnumerable<object>, IEnumerable<string>> OverrideGettingItemMethodNames { get; set; }\n\n\n\n        /// <summary>\n        /// Gets the represented item. USED fOR GetItemProperties\n        /// </summary>\n        /// <returns></returns>\n        protected virtual dynamic GetRepresentedItem()\n        {\n            var tItem = ((IEnumerable<object>)this).FirstOrDefault();\n            return tItem;\n        }\n\n\n        #region Implementation of ICollection\n\n        /// <summary>\n        /// Copies to.\n        /// </summary>\n        /// <param name=\"array\">The array.</param>\n        /// <param name=\"index\">The index.</param>\n        public void CopyTo(Array array, int index)\n        {\n            ((IList)_list).CopyTo(array, index);\n        }\n        private readonly object _syncRoot = new object();\n\n\n        /// <summary>\n        /// Gets the sync root.\n        /// </summary>\n        /// <value>\n        /// The sync root.\n        /// </value>\n        public object SyncRoot => _syncRoot;\n\n\n        /// <summary>\n        /// Gets a value indicating whether this instance is synchronized.\n        /// </summary>\n        /// <value>\n        /// <c>true</c> if this instance is synchronized; otherwise, <c>false</c>.\n        /// </value>\n        public bool IsSynchronized => false;\n\n        #endregion\n\n        #region Implementation of IList\n\n\n        int IList.Add(object value)\n        {\n            Add(value);\n            return Count - 1;\n        }\n\n        void IList.Remove(object value)\n        {\n            Remove(value);\n        }\n\n        /// <summary>\n        /// Gets a value indicating whether this instance is fixed size.\n        /// </summary>\n        /// <value>\n        /// <c>true</c> if this instance is fixed size; otherwise, <c>false</c>.\n        /// </value>\n        public bool IsFixedSize => false;\n\n        #endregion\n    }\n}\n"
  },
  {
    "path": "Dynamitey/DynamicObjects/Mimic.cs",
    "content": "﻿using System.Dynamic;\nusing System;\nusing System.Reflection;\n\n\n\nnamespace Dynamitey.DynamicObjects\n{\n    /// <summary>\n    /// Class for TDD, used for mocking any dynamic object\n    /// </summary>\n   \n    public class Mimic : DynamicObject\n    {\n        /// <summary>\n        /// Override on DynamicObject\n        /// </summary>\n        /// <param name=\"binder\"></param>\n        /// <param name=\"arg\"></param>\n        /// <param name=\"result\"></param>\n        /// <returns></returns>\n        public override bool TryBinaryOperation(BinaryOperationBinder binder, object arg, out object result)\n        {\n            result = new Mimic();\n            return true;\n        }\n\n        /// <summary>\n        /// Override on DynamicObject\n        /// </summary>\n        /// <param name=\"binder\"></param>\n        /// <param name=\"result\"></param>\n        /// <returns></returns>\n        public override bool TryConvert(ConvertBinder binder, out object result)\n        {\n\n            result = Dynamic.InvokeConstructor(binder.ReturnType);\n            return true;\n        }\n\n        /// <summary>\n        /// Override on DynamicObject\n        /// </summary>\n        /// <param name=\"binder\"></param>\n        /// <param name=\"args\"></param>\n        /// <param name=\"result\"></param>\n        /// <returns></returns>\n        public override bool TryCreateInstance(CreateInstanceBinder binder, object[] args, out object result)\n        {\n            result = new Mimic();\n            return true;\n        }\n\n        /// <summary>\n        /// Override on DynamicObject\n        /// </summary>\n        /// <param name=\"binder\"></param>\n        /// <param name=\"indexes\"></param>\n        /// <returns></returns>\n        public override bool TryDeleteIndex(DeleteIndexBinder binder, object[] indexes)\n        {\n            return true;\n        }\n\n        /// <summary>\n        /// Override on DynamicObject\n        /// </summary>\n        /// <param name=\"binder\"></param>\n        /// <returns></returns>\n        public override bool TryDeleteMember(DeleteMemberBinder binder)\n        {\n            return true;\n        }\n\n        /// <summary>\n        /// Override on DynamicObject\n        /// </summary>\n        /// <param name=\"binder\"></param>\n        /// <param name=\"indexes\"></param>\n        /// <param name=\"result\"></param>\n        /// <returns></returns>\n        public override bool TryGetIndex(GetIndexBinder binder, object[] indexes, out object result)\n        {\n            result = new Mimic();\n            return true;\n        }\n\n        /// <summary>\n        /// Override on DynamicObject\n        /// </summary>\n        /// <param name=\"binder\"></param>\n        /// <param name=\"result\"></param>\n        /// <returns></returns>\n        public override bool TryGetMember(GetMemberBinder binder, out object result)\n        {\n            result = new Mimic();\n            return true;\n        }\n\n        /// <summary>\n        /// Override on DynamicObject\n        /// </summary>\n        /// <param name=\"binder\"></param>\n        /// <param name=\"args\"></param>\n        /// <param name=\"result\"></param>\n        /// <returns></returns>\n        public override bool TryInvoke(InvokeBinder binder, object[] args, out object result)\n        {\n            result = new Mimic();\n            return true;\n        }\n\n        /// <summary>\n        /// Override on DynamicObject\n        /// </summary>\n        /// <param name=\"binder\"></param>\n        /// <param name=\"args\"></param>\n        /// <param name=\"result\"></param>\n        /// <returns></returns>\n        public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result)\n        {\n            result = new Mimic();\n            return true;\n        }\n\n        /// <summary>\n        /// Override on DynamicObject\n        /// </summary>\n        /// <param name=\"binder\"></param>\n        /// <param name=\"indexes\"></param>\n        /// <param name=\"value\"></param>\n        /// <returns></returns>\n        public override bool TrySetIndex(SetIndexBinder binder, object[] indexes, object value)\n        {\n            return true;\n        }\n\n        /// <summary>\n        /// Override on DynamicObject\n        /// </summary>\n        /// <param name=\"binder\"></param>\n        /// <param name=\"value\"></param>\n        /// <returns></returns>\n        public override bool TrySetMember(SetMemberBinder binder, object value)\n        {\n            return true;\n        }\n\n        /// <summary>\n        /// Override on DynamicObject\n        /// </summary>\n        /// <param name=\"binder\"></param>\n        /// <param name=\"result\"></param>\n        /// <returns></returns>\n        public override bool TryUnaryOperation(UnaryOperationBinder binder, out object result)\n        {\n            result = new Mimic();\n            return true;\n        }\n\n    }\n}"
  },
  {
    "path": "Dynamitey/DynamicObjects/Recorder.cs",
    "content": "﻿// \n//  Copyright 2011  Ekon Benefits\n// \n//    Licensed under the Apache License, Version 2.0 (the \"License\");\n//    you may not use this file except in compliance with the License.\n//    You may obtain a copy of the License at\n// \n//        http://www.apache.org/licenses/LICENSE-2.0\n// \n//    Unless required by applicable law or agreed to in writing, software\n//    distributed under the License is distributed on an \"AS IS\" BASIS,\n//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//    See the License for the specific language governing permissions and\n//    limitations under the License.\n\n\nusing System;\nusing System.Collections.Generic;\nusing System.Dynamic;\nusing System.Linq;\n\nusing System.Text;\nusing Dynamitey.Internal.Optimization;\n\n\nnamespace Dynamitey.DynamicObjects\n{\n    /// <summary>\n    /// Proxy that Records Dynamic Invocations on an object\n    /// </summary>\n    public class Recorder:BaseForwarder\n    {\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"Recorder\"/> class.\n        /// </summary>\n        public Recorder():base(new Dummy())\n        {\n            Recording = new List<Invocation>();\n        }\n\n        /// <summary>\n        /// Gets or sets the recording.\n        /// </summary>\n        /// <value>The recording.</value>\n       \n        public IList<Invocation> Recording { get; protected set; }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"Recorder\"/> class.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        public Recorder(object target) : base(target)\n        {\n            Recording = new List<Invocation>();\n        }\n\n        /// <summary>\n        /// Replays the recording on target.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        public T ReplayOn<T>(T target)\n        {\n            foreach (var tInvocation in Recording)\n            {\n                tInvocation.InvokeWithStoredArgs(target);\n            }\n\n            return target;\n        }\n\n        /// <summary>\n        /// Provides the implementation for operations that get member values. Classes derived from the <see cref=\"T:System.Dynamic.DynamicObject\" /> class can override this method to specify dynamic behavior for operations such as getting a value for a property.\n        /// </summary>\n        /// <param name=\"binder\">Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member on which the dynamic operation is performed. For example, for the Console.WriteLine(sampleObject.SampleProperty) statement, where sampleObject is an instance of the class derived from the <see cref=\"T:System.Dynamic.DynamicObject\" /> class, binder.Name returns \"SampleProperty\". The binder.IgnoreCase property specifies whether the member name is case-sensitive.</param>\n        /// <param name=\"result\">The result of the get operation. For example, if the method is called for a property, you can assign the property value to <paramref name=\"result\" />.</param>\n        /// <returns>\n        /// true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a run-time exception is thrown.)\n        /// </returns>\n        public override bool TryGetMember(System.Dynamic.GetMemberBinder binder, out object result)\n        {\n            if (base.TryGetMember(binder, out result))\n            {\n                Recording.Add(new Invocation(InvocationKind.Get,binder.Name));\n                return true;\n            }\n            return false;\n        }\n\n        /// <summary>\n        /// Tries the set member.\n        /// </summary>\n        /// <param name=\"binder\">The binder.</param>\n        /// <param name=\"value\">The value.</param>\n        /// <returns></returns>\n        public override bool TrySetMember(System.Dynamic.SetMemberBinder binder, object value)\n        {\n            if (base.TrySetMember(binder, value))\n            {\n                Recording.Add(new Invocation(InvocationKind.Set,binder.Name,value));\n                return true;\n            }\n            return false;\n        }\n\n        /// <summary>\n        /// Tries the invoke member.\n        /// </summary>\n        /// <param name=\"binder\">The binder.</param>\n        /// <param name=\"args\">The args.</param>\n        /// <param name=\"result\">The result.</param>\n        /// <returns></returns>\n        public override bool TryInvokeMember(System.Dynamic.InvokeMemberBinder binder, object[] args, out object result)\n        {\n            if (base.TryInvokeMember(binder, args, out result))\n            {\n                Recording.Add(new Invocation(InvocationKind.InvokeMemberUnknown, binder.Name, Util.NameArgsIfNecessary(binder.CallInfo, args)));\n                return true;\n            }\n            return false;\n        }\n\n        /// <summary>\n        /// Tries the index of the get.\n        /// </summary>\n        /// <param name=\"binder\">The binder.</param>\n        /// <param name=\"indexes\">The indexes.</param>\n        /// <param name=\"result\">The result.</param>\n        /// <returns></returns>\n        public override bool TryGetIndex(System.Dynamic.GetIndexBinder binder, object[] indexes, out object result)\n        {\n            if (base.TryGetIndex(binder, indexes, out result))\n            {\n                Recording.Add(new Invocation(InvocationKind.GetIndex, Invocation.IndexBinderName, Util.NameArgsIfNecessary(binder.CallInfo, indexes)));\n                return true;\n            }\n            return false;\n        }\n\n        /// <summary>\n        /// Tries the index of the set.\n        /// </summary>\n        /// <param name=\"binder\">The binder.</param>\n        /// <param name=\"indexes\">The indexes.</param>\n        /// <param name=\"value\">The value.</param>\n        /// <returns></returns>\n        public override bool TrySetIndex(System.Dynamic.SetIndexBinder binder, object[] indexes, object value)\n        {\n            if (base.TrySetIndex(binder, indexes, value))\n            {\n                var tCombinedArgs = indexes.Concat(new[] { value }).ToArray();\n                Recording.Add(new Invocation(InvocationKind.GetIndex, Invocation.IndexBinderName, Util.NameArgsIfNecessary(binder.CallInfo, tCombinedArgs)));\n                return true;\n            }\n            return false;\n        }\n\n    }\n}\n"
  },
  {
    "path": "Dynamitey/DynamicObjects/RegexMatch.cs",
    "content": "﻿using System;\nusing System.Dynamic;\nusing System.Linq;\n\nusing System.Text.RegularExpressions;\nusing System.Collections.Generic;\nusing System.Reflection;\nusing Dynamitey.Internal.Compat;\n\nnamespace Dynamitey.DynamicObjects\n{\n\n    /// <summary>\n    /// A Regex Match Interface\n    /// </summary>\n    public interface IRegexMatch\n    {\n        /// <summary>\n        /// Gets the value.\n        /// </summary>\n        /// <value>\n        /// The value.\n        /// </value>\n        string Value { get;}\n    }\n\n\n\n    /// <summary>\n    /// A Dynamic Regex Match\n    /// </summary>\n    public class RegexMatch : BaseObject, IRegexMatch\n    {\n       \n        private readonly Match _match;\n       \n        private readonly Regex _regex;\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"RegexMatch\" /> class.\n        /// </summary>\n        /// <param name=\"match\">The match.</param>\n        /// <param name=\"regex\">The regex.</param>\n        public RegexMatch(Match match, Regex regex = null)\n        {\n            _match = match;\n            _regex = regex;\n        }\n\n\n        /// <summary>\n        /// Gets the dynamic member names.\n        /// </summary>\n        /// <returns></returns>\n        public override IEnumerable<string> GetDynamicMemberNames()\n        {\n            if (_regex == null)\n                return Enumerable.Empty<string>();\n            return _regex.GetGroupNames();\n        }\n\n        /// <summary>\n        /// Tries the get member.\n        /// </summary>\n        /// <param name=\"binder\">The binder.</param>\n        /// <param name=\"result\">The result.</param>\n        /// <returns></returns>\n       public override bool TryGetMember(GetMemberBinder binder, out object result)\n        {\n            var tGroup = _match.Groups[binder.Name];\n            if (!TryTypeForName(binder.Name, out var outType))\n                outType = typeof (string);\n\n            if (!tGroup.Success)\n            {\n                result = null;\n                if (outType.GetTypeInfo().IsValueType)\n                    result = Dynamic.InvokeConstructor(outType);\n                return true;\n            }\n\n            result = Dynamic.CoerceConvert(tGroup.Value, outType);\n            return true;\n        }\n\n       /// <summary>\n       /// Gets the <see cref=\"System.String\" /> with the specified value.\n       /// </summary>\n       /// <value>\n       /// The <see cref=\"System.String\" />.\n       /// </value>\n       /// <param name=\"value\">The value.</param>\n       /// <returns></returns>\n        public string this[int value]\n        {\n            get\n            {\n                var tGroup = _match.Groups[value];\n\n                if (!tGroup.Success)\n                {\n                    return null;\n                }\n                return tGroup.Value;\n            }\n        }\n\n        /// <summary>\n        /// Gets the <see cref=\"System.String\" /> with the specified value.\n        /// </summary>\n        /// <value>\n        /// The <see cref=\"System.String\" />.\n        /// </value>\n        /// <param name=\"value\">The value.</param>\n        /// <returns></returns>\n        public string this[string value]\n        {\n            get\n            {\n                var tGroup = _match.Groups[value];\n\n                if (!tGroup.Success)\n                {\n                    return null;\n                }\n                return tGroup.Value;\n            }\n        }\n\n        string IRegexMatch.Value => _match.Value;\n\n        /// <summary>\n        /// Returns a <see cref=\"System.String\" /> that represents this instance.\n        /// </summary>\n        /// <returns>\n        /// A <see cref=\"System.String\" /> that represents this instance.\n        /// </returns>\n        public override string ToString()\n        {\n            return _match.ToString();\n        }\n    }\n}\n"
  },
  {
    "path": "Dynamitey/Dynamitey.csproj",
    "content": "﻿<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <TargetFrameworks>netstandard2.0;net40</TargetFrameworks>\n    <Description>(pronounced dyna-mighty) flexes DLR muscle to do meta-mazing things in .net</Description>\n    <Company>Ekon Benefits</Company>\n    <Authors />\n    <Copyright>Copyright 2017 Ekon Benefits</Copyright>\n    <PackageProjectUrl>https://github.com/ekonbenefits/dynamitey</PackageProjectUrl>\n    <PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>\n    <PackageTags>dynamic metaprogramming dlr reflection currying tuples expando latetypes</PackageTags>\n    <IncludeSymbols>True</IncludeSymbols>\n    <IncludeSource>True</IncludeSource>\n    <GeneratePackageOnBuild>True</GeneratePackageOnBuild>\n    <PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>\n    <SignAssembly>True</SignAssembly>\n    <AssemblyOriginatorKeyFile>sn.snk</AssemblyOriginatorKeyFile>\n    <DelaySign>False</DelaySign>\n\n  </PropertyGroup>\n  \n  <Import Project=\"..\\Version.props\" />\n\n\n  <ItemGroup Condition=\"'$(TargetFramework)'=='netstandard2.0'\">\n    <PackageReference Include=\"Microsoft.CSharp\" Version=\"4.*\" />\n    <PackageReference Include=\"System.ComponentModel\" Version=\"4.3.0\" />\n  </ItemGroup>\n\n  <ItemGroup Condition=\"'$(TargetFramework)'=='net40'\">\n    <Reference Include=\"Microsoft.CSharp\" />\n  </ItemGroup>\n\n\n  <ItemGroup>\n    <None Update=\"InlineLambdas.tt\">\n      <Generator>TextTemplatingFileGenerator</Generator>\n      <LastGenOutput>InlineLambdas.cs</LastGenOutput>\n    </None>\n    <None Update=\"Internal\\Optimization\\InvokeHelper.tt\">\n      <Generator>TextTemplatingFileGenerator</Generator>\n      <LastGenOutput>InvokeHelper.cs</LastGenOutput>\n    </None>\n    <None Update=\"ThisFunctions.tt\">\n      <Generator>TextTemplatingFileGenerator</Generator>\n      <LastGenOutput>ThisFunctions.cs</LastGenOutput>\n    </None>\n  </ItemGroup>\n\n\n  <ItemGroup>\n    <Compile Update=\"InlineLambdas.cs\">\n      <DesignTime>True</DesignTime>\n      <AutoGen>True</AutoGen>\n      <DependentUpon>InlineLambdas.tt</DependentUpon>\n    </Compile>\n    <Compile Update=\"Internal\\Optimization\\InvokeHelper.cs\">\n      <DesignTime>True</DesignTime>\n      <AutoGen>True</AutoGen>\n      <DependentUpon>InvokeHelper.tt</DependentUpon>\n    </Compile>\n    <Compile Update=\"ThisFunctions.cs\">\n      <DesignTime>True</DesignTime>\n      <AutoGen>True</AutoGen>\n      <DependentUpon>ThisFunctions.tt</DependentUpon>\n    </Compile>\n  </ItemGroup>\n\n  <Target Name=\"CopyPackage\" AfterTargets=\"Pack\">\n    <Copy\n            SourceFiles=\"$(OutputPath)$(PackageId).$(PackageVersion).nupkg\"\n            DestinationFolder=\"$(SolutionDir)\\publish\"\n    />\n  </Target>\n  \n</Project>"
  },
  {
    "path": "Dynamitey/Expando.cs",
    "content": "﻿// \n//  Copyright 2011 Ekon Benefits\n// \n//    Licensed under the Apache License, Version 2.0 (the \"License\");\n//    you may not use this file except in compliance with the License.\n//    You may obtain a copy of the License at\n// \n//        http://www.apache.org/licenses/LICENSE-2.0\n// \n//    Unless required by applicable law or agreed to in writing, software\n//    distributed under the License is distributed on an \"AS IS\" BASIS,\n//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//    See the License for the specific language governing permissions and\n//    limitations under the License.\n\nusing System.Dynamic;\nusing Dynamitey.DynamicObjects;\n\nnamespace Dynamitey\n{\n    public class Expando : Builder<ExpandoObject>\n    {\n        // ReSharper disable StaticFieldInGenericType\n        private static readonly dynamic _expandoBuilder = new Builder<ExpandoObject>().Object;\n        // ReSharper restore StaticFieldInGenericType        \n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"Expando\"/> class.\n        /// This constructor is shorthand for new Builder&lt;ExpandoObject>();\n        /// </summary>\n        public Expando()\n        {\n        }\n\n        /// <summary>\n        /// Gets the new expandoObject builder. This method is short hand for Build&gt;ExpandoObject>.NewObject()\n        /// </summary>\n        /// <value>The new expandoObject.</value>\n        public static dynamic New => _expandoBuilder;\n    }\n}\n"
  },
  {
    "path": "Dynamitey/FluentRegex.cs",
    "content": "﻿using System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace Dynamitey\n{\n    /// <summary>\n    /// Extension Methods for fluent Regex\n    /// </summary>\n    public static class FluentRegex\n    {\n\n        /// <summary>\n        /// Fluents the filter.\n        /// </summary>\n        /// <param name=\"list\">The list.</param>\n        /// <param name=\"regex\">The regex.</param>\n        /// <returns></returns>\n        public static IEnumerable<dynamic> FluentFilter(this IEnumerable<string> list, Regex regex)\n        {\n            return list.Select(it => regex.Match(it)).Where(it => it.Success).Select(it => new DynamicObjects.RegexMatch(it, regex)).Cast<dynamic>();\n        }\n\n        /// <summary>\n        /// Matches the specified input string.\n        /// </summary>\n        /// <param name=\"inputString\">The input string.</param>\n        /// <param name=\"regex\">The regex.</param>\n        /// <returns></returns>\n        public static IEnumerable<dynamic> Matches(string inputString, Regex regex)\n        {\n            var tMatches = regex.Matches(inputString);\n\n            return tMatches.Cast<Match>().Where(it => it.Success).Select(it => new DynamicObjects.RegexMatch(it, regex)).Cast<dynamic>();\n        }\n\n        /// <summary>\n        /// Matches the specified input string.\n        /// </summary>\n        /// <param name=\"inputString\">The input string.</param>\n        /// <param name=\"regex\">The regex.</param>\n        /// <returns></returns>\n        public static dynamic Match(string inputString, Regex regex)\n        {\n            var tMatch = regex.Match(inputString);\n            return tMatch.Success ? new DynamicObjects.RegexMatch(tMatch, regex) : null;\n        }\n\n        /// <summary>\n        /// Fluents the match.\n        /// </summary>\n        /// <param name=\"regex\">The regex.</param>\n        /// <param name=\"inputString\">The input string.</param>\n        /// <returns></returns>\n        public static dynamic FluentMatch(this Regex regex, string inputString)\n        {\n            var tMatch = regex.Match(inputString);\n            return tMatch.Success ? new DynamicObjects.RegexMatch(tMatch, regex) : null;\n        }\n\n        /// <summary>\n        /// Fluents the matches.\n        /// </summary>\n        /// <param name=\"regex\">The regex.</param>\n        /// <param name=\"inputString\">The input string.</param>\n        /// <returns></returns>\n        public static IEnumerable<dynamic> FluentMatches(this Regex regex, string inputString)\n        {\n            return Matches(inputString, regex);\n        }\n\n    }\n}\n"
  },
  {
    "path": "Dynamitey/InlineLambdas.cs",
    "content": "﻿//  Copyright 2010  Ekon Benefits\n// \n//    Licensed under the Apache License, Version 2.0 (the \"License\");\n//    you may not use this file except in compliance with the License.\n//    You may obtain a copy of the License at\n// \n//        http://www.apache.org/licenses/LICENSE-2.0\n// \n//    Unless required by applicable law or agreed to in writing, software\n//    distributed under the License is distributed on an \"AS IS\" BASIS,\n//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//    See the License for the specific language governing permissions and\n//    limitations under the License.\n\nusing System;\nusing System.Linq;\n\nnamespace Dynamitey\n{\n\n    /// <summary>\n    /// Fluent Class for writing inline lambdass\n    /// </summary>\n    /// <typeparam name=\"TR\">The type of the R.</typeparam>\n    public static class Return<TR>\n    {\n\t\t\n\t\t/// <summary>\n        /// Arguments\n        /// </summary>\n        /// <param name=\"del\">The lambda.</param>\n        /// <returns>The lambda.</returns>\n        public static Func<TR> Arguments(Func<TR> del)\n        {\n            return del;\n        }\n\n\n        /// <summary>\n        /// This and arguments.\n        /// </summary>\n        /// <param name=\"del\">The del.</param>\n        /// <returns></returns>\n        public static ThisFunc<TR> ThisAndArguments(ThisFunc<TR> del)\n        {\n            return del;\n        }\n\n\t\t\n\t\t\n\n        /// <summary>\n        /// Arguments \n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n        /// <param name=\"del\">The lambdas.</param>\n        /// <returns></returns>\n        public static Func<T1,TR> Arguments<T1>(Func<T1,TR> del)\n        {\n            return del;\n        }\n\n        /// <summary>\n        /// this and Arguments.\n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n        /// <param name=\"del\">The del.</param>\n        /// <returns></returns>\n        public static ThisFunc<TR,T1> ThisAndArguments<T1>(ThisFunc<TR,T1> del)\n        {\n            return del;\n        }\n\n     \n\t\t\n\n        /// <summary>\n        /// Arguments \n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n        /// <param name=\"del\">The lambdas.</param>\n        /// <returns></returns>\n        public static Func<T1,T2,TR> Arguments<T1,T2>(Func<T1,T2,TR> del)\n        {\n            return del;\n        }\n\n        /// <summary>\n        /// this and Arguments.\n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n        /// <param name=\"del\">The del.</param>\n        /// <returns></returns>\n        public static ThisFunc<TR,T1,T2> ThisAndArguments<T1,T2>(ThisFunc<TR,T1,T2> del)\n        {\n            return del;\n        }\n\n     \n\t\t\n\n        /// <summary>\n        /// Arguments \n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n        /// <param name=\"del\">The lambdas.</param>\n        /// <returns></returns>\n        public static Func<T1,T2,T3,TR> Arguments<T1,T2,T3>(Func<T1,T2,T3,TR> del)\n        {\n            return del;\n        }\n\n        /// <summary>\n        /// this and Arguments.\n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n        /// <param name=\"del\">The del.</param>\n        /// <returns></returns>\n        public static ThisFunc<TR,T1,T2,T3> ThisAndArguments<T1,T2,T3>(ThisFunc<TR,T1,T2,T3> del)\n        {\n            return del;\n        }\n\n     \n\t\t\n\n        /// <summary>\n        /// Arguments \n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n        /// <param name=\"del\">The lambdas.</param>\n        /// <returns></returns>\n        public static Func<T1,T2,T3,T4,TR> Arguments<T1,T2,T3,T4>(Func<T1,T2,T3,T4,TR> del)\n        {\n            return del;\n        }\n\n        /// <summary>\n        /// this and Arguments.\n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n        /// <param name=\"del\">The del.</param>\n        /// <returns></returns>\n        public static ThisFunc<TR,T1,T2,T3,T4> ThisAndArguments<T1,T2,T3,T4>(ThisFunc<TR,T1,T2,T3,T4> del)\n        {\n            return del;\n        }\n\n     \n\t\t\n\n        /// <summary>\n        /// Arguments \n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n        /// <param name=\"del\">The lambdas.</param>\n        /// <returns></returns>\n        public static Func<T1,T2,T3,T4,T5,TR> Arguments<T1,T2,T3,T4,T5>(Func<T1,T2,T3,T4,T5,TR> del)\n        {\n            return del;\n        }\n\n        /// <summary>\n        /// this and Arguments.\n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n        /// <param name=\"del\">The del.</param>\n        /// <returns></returns>\n        public static ThisFunc<TR,T1,T2,T3,T4,T5> ThisAndArguments<T1,T2,T3,T4,T5>(ThisFunc<TR,T1,T2,T3,T4,T5> del)\n        {\n            return del;\n        }\n\n     \n\t\t\n\n        /// <summary>\n        /// Arguments \n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n        /// <param name=\"del\">The lambdas.</param>\n        /// <returns></returns>\n        public static Func<T1,T2,T3,T4,T5,T6,TR> Arguments<T1,T2,T3,T4,T5,T6>(Func<T1,T2,T3,T4,T5,T6,TR> del)\n        {\n            return del;\n        }\n\n        /// <summary>\n        /// this and Arguments.\n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n        /// <param name=\"del\">The del.</param>\n        /// <returns></returns>\n        public static ThisFunc<TR,T1,T2,T3,T4,T5,T6> ThisAndArguments<T1,T2,T3,T4,T5,T6>(ThisFunc<TR,T1,T2,T3,T4,T5,T6> del)\n        {\n            return del;\n        }\n\n     \n\t\t\n\n        /// <summary>\n        /// Arguments \n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n        /// <param name=\"del\">The lambdas.</param>\n        /// <returns></returns>\n        public static Func<T1,T2,T3,T4,T5,T6,T7,TR> Arguments<T1,T2,T3,T4,T5,T6,T7>(Func<T1,T2,T3,T4,T5,T6,T7,TR> del)\n        {\n            return del;\n        }\n\n        /// <summary>\n        /// this and Arguments.\n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n        /// <param name=\"del\">The del.</param>\n        /// <returns></returns>\n        public static ThisFunc<TR,T1,T2,T3,T4,T5,T6,T7> ThisAndArguments<T1,T2,T3,T4,T5,T6,T7>(ThisFunc<TR,T1,T2,T3,T4,T5,T6,T7> del)\n        {\n            return del;\n        }\n\n     \n\t\t\n\n        /// <summary>\n        /// Arguments \n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n        /// <param name=\"del\">The lambdas.</param>\n        /// <returns></returns>\n        public static Func<T1,T2,T3,T4,T5,T6,T7,T8,TR> Arguments<T1,T2,T3,T4,T5,T6,T7,T8>(Func<T1,T2,T3,T4,T5,T6,T7,T8,TR> del)\n        {\n            return del;\n        }\n\n        /// <summary>\n        /// this and Arguments.\n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n        /// <param name=\"del\">The del.</param>\n        /// <returns></returns>\n        public static ThisFunc<TR,T1,T2,T3,T4,T5,T6,T7,T8> ThisAndArguments<T1,T2,T3,T4,T5,T6,T7,T8>(ThisFunc<TR,T1,T2,T3,T4,T5,T6,T7,T8> del)\n        {\n            return del;\n        }\n\n     \n\t\t\n\n        /// <summary>\n        /// Arguments \n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n\t\t/// <typeparam name=\"T9\">The type of the Argument 9.</typeparam>\n        /// <param name=\"del\">The lambdas.</param>\n        /// <returns></returns>\n        public static Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,TR> Arguments<T1,T2,T3,T4,T5,T6,T7,T8,T9>(Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,TR> del)\n        {\n            return del;\n        }\n\n        /// <summary>\n        /// this and Arguments.\n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n\t\t/// <typeparam name=\"T9\">The type of the Argument 9.</typeparam>\n        /// <param name=\"del\">The del.</param>\n        /// <returns></returns>\n        public static ThisFunc<TR,T1,T2,T3,T4,T5,T6,T7,T8,T9> ThisAndArguments<T1,T2,T3,T4,T5,T6,T7,T8,T9>(ThisFunc<TR,T1,T2,T3,T4,T5,T6,T7,T8,T9> del)\n        {\n            return del;\n        }\n\n     \n\t\t\n\n        /// <summary>\n        /// Arguments \n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n\t\t/// <typeparam name=\"T9\">The type of the Argument 9.</typeparam>\n\t\t/// <typeparam name=\"T10\">The type of the Argument 10.</typeparam>\n        /// <param name=\"del\">The lambdas.</param>\n        /// <returns></returns>\n        public static Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,TR> Arguments<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>(Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,TR> del)\n        {\n            return del;\n        }\n\n        /// <summary>\n        /// this and Arguments.\n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n\t\t/// <typeparam name=\"T9\">The type of the Argument 9.</typeparam>\n\t\t/// <typeparam name=\"T10\">The type of the Argument 10.</typeparam>\n        /// <param name=\"del\">The del.</param>\n        /// <returns></returns>\n        public static ThisFunc<TR,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> ThisAndArguments<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>(ThisFunc<TR,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> del)\n        {\n            return del;\n        }\n\n     \n\t\t\n\n        /// <summary>\n        /// Arguments \n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n\t\t/// <typeparam name=\"T9\">The type of the Argument 9.</typeparam>\n\t\t/// <typeparam name=\"T10\">The type of the Argument 10.</typeparam>\n\t\t/// <typeparam name=\"T11\">The type of the Argument 11.</typeparam>\n        /// <param name=\"del\">The lambdas.</param>\n        /// <returns></returns>\n        public static Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,TR> Arguments<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>(Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,TR> del)\n        {\n            return del;\n        }\n\n        /// <summary>\n        /// this and Arguments.\n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n\t\t/// <typeparam name=\"T9\">The type of the Argument 9.</typeparam>\n\t\t/// <typeparam name=\"T10\">The type of the Argument 10.</typeparam>\n\t\t/// <typeparam name=\"T11\">The type of the Argument 11.</typeparam>\n        /// <param name=\"del\">The del.</param>\n        /// <returns></returns>\n        public static ThisFunc<TR,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11> ThisAndArguments<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>(ThisFunc<TR,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11> del)\n        {\n            return del;\n        }\n\n     \n\t\t\n\n        /// <summary>\n        /// Arguments \n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n\t\t/// <typeparam name=\"T9\">The type of the Argument 9.</typeparam>\n\t\t/// <typeparam name=\"T10\">The type of the Argument 10.</typeparam>\n\t\t/// <typeparam name=\"T11\">The type of the Argument 11.</typeparam>\n\t\t/// <typeparam name=\"T12\">The type of the Argument 12.</typeparam>\n        /// <param name=\"del\">The lambdas.</param>\n        /// <returns></returns>\n        public static Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,TR> Arguments<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>(Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,TR> del)\n        {\n            return del;\n        }\n\n        /// <summary>\n        /// this and Arguments.\n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n\t\t/// <typeparam name=\"T9\">The type of the Argument 9.</typeparam>\n\t\t/// <typeparam name=\"T10\">The type of the Argument 10.</typeparam>\n\t\t/// <typeparam name=\"T11\">The type of the Argument 11.</typeparam>\n\t\t/// <typeparam name=\"T12\">The type of the Argument 12.</typeparam>\n        /// <param name=\"del\">The del.</param>\n        /// <returns></returns>\n        public static ThisFunc<TR,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12> ThisAndArguments<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>(ThisFunc<TR,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12> del)\n        {\n            return del;\n        }\n\n     \n\t\t\n\n        /// <summary>\n        /// Arguments \n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n\t\t/// <typeparam name=\"T9\">The type of the Argument 9.</typeparam>\n\t\t/// <typeparam name=\"T10\">The type of the Argument 10.</typeparam>\n\t\t/// <typeparam name=\"T11\">The type of the Argument 11.</typeparam>\n\t\t/// <typeparam name=\"T12\">The type of the Argument 12.</typeparam>\n\t\t/// <typeparam name=\"T13\">The type of the Argument 13.</typeparam>\n        /// <param name=\"del\">The lambdas.</param>\n        /// <returns></returns>\n        public static Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,TR> Arguments<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>(Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,TR> del)\n        {\n            return del;\n        }\n\n        /// <summary>\n        /// this and Arguments.\n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n\t\t/// <typeparam name=\"T9\">The type of the Argument 9.</typeparam>\n\t\t/// <typeparam name=\"T10\">The type of the Argument 10.</typeparam>\n\t\t/// <typeparam name=\"T11\">The type of the Argument 11.</typeparam>\n\t\t/// <typeparam name=\"T12\">The type of the Argument 12.</typeparam>\n\t\t/// <typeparam name=\"T13\">The type of the Argument 13.</typeparam>\n        /// <param name=\"del\">The del.</param>\n        /// <returns></returns>\n        public static ThisFunc<TR,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13> ThisAndArguments<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>(ThisFunc<TR,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13> del)\n        {\n            return del;\n        }\n\n     \n\t\t\n\n        /// <summary>\n        /// Arguments \n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n\t\t/// <typeparam name=\"T9\">The type of the Argument 9.</typeparam>\n\t\t/// <typeparam name=\"T10\">The type of the Argument 10.</typeparam>\n\t\t/// <typeparam name=\"T11\">The type of the Argument 11.</typeparam>\n\t\t/// <typeparam name=\"T12\">The type of the Argument 12.</typeparam>\n\t\t/// <typeparam name=\"T13\">The type of the Argument 13.</typeparam>\n\t\t/// <typeparam name=\"T14\">The type of the Argument 14.</typeparam>\n        /// <param name=\"del\">The lambdas.</param>\n        /// <returns></returns>\n        public static Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,TR> Arguments<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>(Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,TR> del)\n        {\n            return del;\n        }\n\n        /// <summary>\n        /// this and Arguments.\n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n\t\t/// <typeparam name=\"T9\">The type of the Argument 9.</typeparam>\n\t\t/// <typeparam name=\"T10\">The type of the Argument 10.</typeparam>\n\t\t/// <typeparam name=\"T11\">The type of the Argument 11.</typeparam>\n\t\t/// <typeparam name=\"T12\">The type of the Argument 12.</typeparam>\n\t\t/// <typeparam name=\"T13\">The type of the Argument 13.</typeparam>\n\t\t/// <typeparam name=\"T14\">The type of the Argument 14.</typeparam>\n        /// <param name=\"del\">The del.</param>\n        /// <returns></returns>\n        public static ThisFunc<TR,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14> ThisAndArguments<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>(ThisFunc<TR,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14> del)\n        {\n            return del;\n        }\n\n     \n\t\t\n\n        /// <summary>\n        /// Arguments \n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n\t\t/// <typeparam name=\"T9\">The type of the Argument 9.</typeparam>\n\t\t/// <typeparam name=\"T10\">The type of the Argument 10.</typeparam>\n\t\t/// <typeparam name=\"T11\">The type of the Argument 11.</typeparam>\n\t\t/// <typeparam name=\"T12\">The type of the Argument 12.</typeparam>\n\t\t/// <typeparam name=\"T13\">The type of the Argument 13.</typeparam>\n\t\t/// <typeparam name=\"T14\">The type of the Argument 14.</typeparam>\n\t\t/// <typeparam name=\"T15\">The type of the Argument 15.</typeparam>\n        /// <param name=\"del\">The lambdas.</param>\n        /// <returns></returns>\n        public static Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,TR> Arguments<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>(Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,TR> del)\n        {\n            return del;\n        }\n\n        /// <summary>\n        /// this and Arguments.\n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n\t\t/// <typeparam name=\"T9\">The type of the Argument 9.</typeparam>\n\t\t/// <typeparam name=\"T10\">The type of the Argument 10.</typeparam>\n\t\t/// <typeparam name=\"T11\">The type of the Argument 11.</typeparam>\n\t\t/// <typeparam name=\"T12\">The type of the Argument 12.</typeparam>\n\t\t/// <typeparam name=\"T13\">The type of the Argument 13.</typeparam>\n\t\t/// <typeparam name=\"T14\">The type of the Argument 14.</typeparam>\n\t\t/// <typeparam name=\"T15\">The type of the Argument 15.</typeparam>\n        /// <param name=\"del\">The del.</param>\n        /// <returns></returns>\n        public static ThisFunc<TR,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15> ThisAndArguments<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>(ThisFunc<TR,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15> del)\n        {\n            return del;\n        }\n\n     \n\t\t\n\n        /// <summary>\n        /// Arguments \n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n\t\t/// <typeparam name=\"T9\">The type of the Argument 9.</typeparam>\n\t\t/// <typeparam name=\"T10\">The type of the Argument 10.</typeparam>\n\t\t/// <typeparam name=\"T11\">The type of the Argument 11.</typeparam>\n\t\t/// <typeparam name=\"T12\">The type of the Argument 12.</typeparam>\n\t\t/// <typeparam name=\"T13\">The type of the Argument 13.</typeparam>\n\t\t/// <typeparam name=\"T14\">The type of the Argument 14.</typeparam>\n\t\t/// <typeparam name=\"T15\">The type of the Argument 15.</typeparam>\n\t\t/// <typeparam name=\"T16\">The type of the Argument 16.</typeparam>\n        /// <param name=\"del\">The lambdas.</param>\n        /// <returns></returns>\n        public static Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,TR> Arguments<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>(Func<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,TR> del)\n        {\n            return del;\n        }\n\n        /// <summary>\n        /// this and Arguments.\n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n\t\t/// <typeparam name=\"T9\">The type of the Argument 9.</typeparam>\n\t\t/// <typeparam name=\"T10\">The type of the Argument 10.</typeparam>\n\t\t/// <typeparam name=\"T11\">The type of the Argument 11.</typeparam>\n\t\t/// <typeparam name=\"T12\">The type of the Argument 12.</typeparam>\n\t\t/// <typeparam name=\"T13\">The type of the Argument 13.</typeparam>\n\t\t/// <typeparam name=\"T14\">The type of the Argument 14.</typeparam>\n\t\t/// <typeparam name=\"T15\">The type of the Argument 15.</typeparam>\n\t\t/// <typeparam name=\"T16\">The type of the Argument 16.</typeparam>\n        /// <param name=\"del\">The del.</param>\n        /// <returns></returns>\n        public static ThisFunc<TR,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16> ThisAndArguments<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>(ThisFunc<TR,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16> del)\n        {\n            return del;\n        }\n\n     \t}\n\n\n\t/// <summary>\n    /// Fluent class for writing inline lambdas that return void\n    /// </summary>\n\tpublic static class ReturnVoid\n    { \n\t    /// <summary>\n        /// Arguments\n        /// </summary>\n        /// <param name=\"del\">The lambda.</param>\n        /// <returns>The lambda.</returns>\n        public static Action Arguments(Action del)\n        {\n            return del;\n        }\n\n\n        /// <summary>\n        /// This and arguments.\n        /// </summary>\n        /// <param name=\"del\">The del.</param>\n        /// <returns></returns>\n        public static ThisAction ThisAndArguments(ThisAction del)\n        {\n            return del;\n        }\n\n\n\t\t\n\t\t\n        /// <summary>\n        /// Arguments\n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n        /// <param name=\"del\">The lambda.</param>\n        /// <returns>The lambda.</returns>\n\t\t public static Action<T1> Arguments<T1>(Action<T1> del)\n        {\n            return del;\n        }\n\n\n         /// <summary>\n         /// This and Arguments.\n         /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n         /// <param name=\"del\">The del.</param>\n         /// <returns></returns>\n         public static ThisAction<T1> ThisAndArguments<T1>(ThisAction<T1> del)\n         {\n             return del;\n         }\n\n\t\t \n\t\t\n        /// <summary>\n        /// Arguments\n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n        /// <param name=\"del\">The lambda.</param>\n        /// <returns>The lambda.</returns>\n\t\t public static Action<T1,T2> Arguments<T1,T2>(Action<T1,T2> del)\n        {\n            return del;\n        }\n\n\n         /// <summary>\n         /// This and Arguments.\n         /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n         /// <param name=\"del\">The del.</param>\n         /// <returns></returns>\n         public static ThisAction<T1,T2> ThisAndArguments<T1,T2>(ThisAction<T1,T2> del)\n         {\n             return del;\n         }\n\n\t\t \n\t\t\n        /// <summary>\n        /// Arguments\n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n        /// <param name=\"del\">The lambda.</param>\n        /// <returns>The lambda.</returns>\n\t\t public static Action<T1,T2,T3> Arguments<T1,T2,T3>(Action<T1,T2,T3> del)\n        {\n            return del;\n        }\n\n\n         /// <summary>\n         /// This and Arguments.\n         /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n         /// <param name=\"del\">The del.</param>\n         /// <returns></returns>\n         public static ThisAction<T1,T2,T3> ThisAndArguments<T1,T2,T3>(ThisAction<T1,T2,T3> del)\n         {\n             return del;\n         }\n\n\t\t \n\t\t\n        /// <summary>\n        /// Arguments\n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n        /// <param name=\"del\">The lambda.</param>\n        /// <returns>The lambda.</returns>\n\t\t public static Action<T1,T2,T3,T4> Arguments<T1,T2,T3,T4>(Action<T1,T2,T3,T4> del)\n        {\n            return del;\n        }\n\n\n         /// <summary>\n         /// This and Arguments.\n         /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n         /// <param name=\"del\">The del.</param>\n         /// <returns></returns>\n         public static ThisAction<T1,T2,T3,T4> ThisAndArguments<T1,T2,T3,T4>(ThisAction<T1,T2,T3,T4> del)\n         {\n             return del;\n         }\n\n\t\t \n\t\t\n        /// <summary>\n        /// Arguments\n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n        /// <param name=\"del\">The lambda.</param>\n        /// <returns>The lambda.</returns>\n\t\t public static Action<T1,T2,T3,T4,T5> Arguments<T1,T2,T3,T4,T5>(Action<T1,T2,T3,T4,T5> del)\n        {\n            return del;\n        }\n\n\n         /// <summary>\n         /// This and Arguments.\n         /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n         /// <param name=\"del\">The del.</param>\n         /// <returns></returns>\n         public static ThisAction<T1,T2,T3,T4,T5> ThisAndArguments<T1,T2,T3,T4,T5>(ThisAction<T1,T2,T3,T4,T5> del)\n         {\n             return del;\n         }\n\n\t\t \n\t\t\n        /// <summary>\n        /// Arguments\n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n        /// <param name=\"del\">The lambda.</param>\n        /// <returns>The lambda.</returns>\n\t\t public static Action<T1,T2,T3,T4,T5,T6> Arguments<T1,T2,T3,T4,T5,T6>(Action<T1,T2,T3,T4,T5,T6> del)\n        {\n            return del;\n        }\n\n\n         /// <summary>\n         /// This and Arguments.\n         /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n         /// <param name=\"del\">The del.</param>\n         /// <returns></returns>\n         public static ThisAction<T1,T2,T3,T4,T5,T6> ThisAndArguments<T1,T2,T3,T4,T5,T6>(ThisAction<T1,T2,T3,T4,T5,T6> del)\n         {\n             return del;\n         }\n\n\t\t \n\t\t\n        /// <summary>\n        /// Arguments\n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n        /// <param name=\"del\">The lambda.</param>\n        /// <returns>The lambda.</returns>\n\t\t public static Action<T1,T2,T3,T4,T5,T6,T7> Arguments<T1,T2,T3,T4,T5,T6,T7>(Action<T1,T2,T3,T4,T5,T6,T7> del)\n        {\n            return del;\n        }\n\n\n         /// <summary>\n         /// This and Arguments.\n         /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n         /// <param name=\"del\">The del.</param>\n         /// <returns></returns>\n         public static ThisAction<T1,T2,T3,T4,T5,T6,T7> ThisAndArguments<T1,T2,T3,T4,T5,T6,T7>(ThisAction<T1,T2,T3,T4,T5,T6,T7> del)\n         {\n             return del;\n         }\n\n\t\t \n\t\t\n        /// <summary>\n        /// Arguments\n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n        /// <param name=\"del\">The lambda.</param>\n        /// <returns>The lambda.</returns>\n\t\t public static Action<T1,T2,T3,T4,T5,T6,T7,T8> Arguments<T1,T2,T3,T4,T5,T6,T7,T8>(Action<T1,T2,T3,T4,T5,T6,T7,T8> del)\n        {\n            return del;\n        }\n\n\n         /// <summary>\n         /// This and Arguments.\n         /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n         /// <param name=\"del\">The del.</param>\n         /// <returns></returns>\n         public static ThisAction<T1,T2,T3,T4,T5,T6,T7,T8> ThisAndArguments<T1,T2,T3,T4,T5,T6,T7,T8>(ThisAction<T1,T2,T3,T4,T5,T6,T7,T8> del)\n         {\n             return del;\n         }\n\n\t\t \n\t\t\n        /// <summary>\n        /// Arguments\n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n\t\t/// <typeparam name=\"T9\">The type of the Argument 9.</typeparam>\n        /// <param name=\"del\">The lambda.</param>\n        /// <returns>The lambda.</returns>\n\t\t public static Action<T1,T2,T3,T4,T5,T6,T7,T8,T9> Arguments<T1,T2,T3,T4,T5,T6,T7,T8,T9>(Action<T1,T2,T3,T4,T5,T6,T7,T8,T9> del)\n        {\n            return del;\n        }\n\n\n         /// <summary>\n         /// This and Arguments.\n         /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n\t\t/// <typeparam name=\"T9\">The type of the Argument 9.</typeparam>\n         /// <param name=\"del\">The del.</param>\n         /// <returns></returns>\n         public static ThisAction<T1,T2,T3,T4,T5,T6,T7,T8,T9> ThisAndArguments<T1,T2,T3,T4,T5,T6,T7,T8,T9>(ThisAction<T1,T2,T3,T4,T5,T6,T7,T8,T9> del)\n         {\n             return del;\n         }\n\n\t\t \n\t\t\n        /// <summary>\n        /// Arguments\n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n\t\t/// <typeparam name=\"T9\">The type of the Argument 9.</typeparam>\n\t\t/// <typeparam name=\"T10\">The type of the Argument 10.</typeparam>\n        /// <param name=\"del\">The lambda.</param>\n        /// <returns>The lambda.</returns>\n\t\t public static Action<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> Arguments<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>(Action<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> del)\n        {\n            return del;\n        }\n\n\n         /// <summary>\n         /// This and Arguments.\n         /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n\t\t/// <typeparam name=\"T9\">The type of the Argument 9.</typeparam>\n\t\t/// <typeparam name=\"T10\">The type of the Argument 10.</typeparam>\n         /// <param name=\"del\">The del.</param>\n         /// <returns></returns>\n         public static ThisAction<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> ThisAndArguments<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10>(ThisAction<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> del)\n         {\n             return del;\n         }\n\n\t\t \n\t\t\n        /// <summary>\n        /// Arguments\n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n\t\t/// <typeparam name=\"T9\">The type of the Argument 9.</typeparam>\n\t\t/// <typeparam name=\"T10\">The type of the Argument 10.</typeparam>\n\t\t/// <typeparam name=\"T11\">The type of the Argument 11.</typeparam>\n        /// <param name=\"del\">The lambda.</param>\n        /// <returns>The lambda.</returns>\n\t\t public static Action<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11> Arguments<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>(Action<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11> del)\n        {\n            return del;\n        }\n\n\n         /// <summary>\n         /// This and Arguments.\n         /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n\t\t/// <typeparam name=\"T9\">The type of the Argument 9.</typeparam>\n\t\t/// <typeparam name=\"T10\">The type of the Argument 10.</typeparam>\n\t\t/// <typeparam name=\"T11\">The type of the Argument 11.</typeparam>\n         /// <param name=\"del\">The del.</param>\n         /// <returns></returns>\n         public static ThisAction<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11> ThisAndArguments<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11>(ThisAction<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11> del)\n         {\n             return del;\n         }\n\n\t\t \n\t\t\n        /// <summary>\n        /// Arguments\n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n\t\t/// <typeparam name=\"T9\">The type of the Argument 9.</typeparam>\n\t\t/// <typeparam name=\"T10\">The type of the Argument 10.</typeparam>\n\t\t/// <typeparam name=\"T11\">The type of the Argument 11.</typeparam>\n\t\t/// <typeparam name=\"T12\">The type of the Argument 12.</typeparam>\n        /// <param name=\"del\">The lambda.</param>\n        /// <returns>The lambda.</returns>\n\t\t public static Action<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12> Arguments<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>(Action<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12> del)\n        {\n            return del;\n        }\n\n\n         /// <summary>\n         /// This and Arguments.\n         /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n\t\t/// <typeparam name=\"T9\">The type of the Argument 9.</typeparam>\n\t\t/// <typeparam name=\"T10\">The type of the Argument 10.</typeparam>\n\t\t/// <typeparam name=\"T11\">The type of the Argument 11.</typeparam>\n\t\t/// <typeparam name=\"T12\">The type of the Argument 12.</typeparam>\n         /// <param name=\"del\">The del.</param>\n         /// <returns></returns>\n         public static ThisAction<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12> ThisAndArguments<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12>(ThisAction<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12> del)\n         {\n             return del;\n         }\n\n\t\t \n\t\t\n        /// <summary>\n        /// Arguments\n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n\t\t/// <typeparam name=\"T9\">The type of the Argument 9.</typeparam>\n\t\t/// <typeparam name=\"T10\">The type of the Argument 10.</typeparam>\n\t\t/// <typeparam name=\"T11\">The type of the Argument 11.</typeparam>\n\t\t/// <typeparam name=\"T12\">The type of the Argument 12.</typeparam>\n\t\t/// <typeparam name=\"T13\">The type of the Argument 13.</typeparam>\n        /// <param name=\"del\">The lambda.</param>\n        /// <returns>The lambda.</returns>\n\t\t public static Action<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13> Arguments<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>(Action<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13> del)\n        {\n            return del;\n        }\n\n\n         /// <summary>\n         /// This and Arguments.\n         /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n\t\t/// <typeparam name=\"T9\">The type of the Argument 9.</typeparam>\n\t\t/// <typeparam name=\"T10\">The type of the Argument 10.</typeparam>\n\t\t/// <typeparam name=\"T11\">The type of the Argument 11.</typeparam>\n\t\t/// <typeparam name=\"T12\">The type of the Argument 12.</typeparam>\n\t\t/// <typeparam name=\"T13\">The type of the Argument 13.</typeparam>\n         /// <param name=\"del\">The del.</param>\n         /// <returns></returns>\n         public static ThisAction<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13> ThisAndArguments<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13>(ThisAction<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13> del)\n         {\n             return del;\n         }\n\n\t\t \n\t\t\n        /// <summary>\n        /// Arguments\n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n\t\t/// <typeparam name=\"T9\">The type of the Argument 9.</typeparam>\n\t\t/// <typeparam name=\"T10\">The type of the Argument 10.</typeparam>\n\t\t/// <typeparam name=\"T11\">The type of the Argument 11.</typeparam>\n\t\t/// <typeparam name=\"T12\">The type of the Argument 12.</typeparam>\n\t\t/// <typeparam name=\"T13\">The type of the Argument 13.</typeparam>\n\t\t/// <typeparam name=\"T14\">The type of the Argument 14.</typeparam>\n        /// <param name=\"del\">The lambda.</param>\n        /// <returns>The lambda.</returns>\n\t\t public static Action<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14> Arguments<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>(Action<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14> del)\n        {\n            return del;\n        }\n\n\n         /// <summary>\n         /// This and Arguments.\n         /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n\t\t/// <typeparam name=\"T9\">The type of the Argument 9.</typeparam>\n\t\t/// <typeparam name=\"T10\">The type of the Argument 10.</typeparam>\n\t\t/// <typeparam name=\"T11\">The type of the Argument 11.</typeparam>\n\t\t/// <typeparam name=\"T12\">The type of the Argument 12.</typeparam>\n\t\t/// <typeparam name=\"T13\">The type of the Argument 13.</typeparam>\n\t\t/// <typeparam name=\"T14\">The type of the Argument 14.</typeparam>\n         /// <param name=\"del\">The del.</param>\n         /// <returns></returns>\n         public static ThisAction<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14> ThisAndArguments<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14>(ThisAction<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14> del)\n         {\n             return del;\n         }\n\n\t\t \n\t\t\n        /// <summary>\n        /// Arguments\n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n\t\t/// <typeparam name=\"T9\">The type of the Argument 9.</typeparam>\n\t\t/// <typeparam name=\"T10\">The type of the Argument 10.</typeparam>\n\t\t/// <typeparam name=\"T11\">The type of the Argument 11.</typeparam>\n\t\t/// <typeparam name=\"T12\">The type of the Argument 12.</typeparam>\n\t\t/// <typeparam name=\"T13\">The type of the Argument 13.</typeparam>\n\t\t/// <typeparam name=\"T14\">The type of the Argument 14.</typeparam>\n\t\t/// <typeparam name=\"T15\">The type of the Argument 15.</typeparam>\n        /// <param name=\"del\">The lambda.</param>\n        /// <returns>The lambda.</returns>\n\t\t public static Action<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15> Arguments<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>(Action<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15> del)\n        {\n            return del;\n        }\n\n\n         /// <summary>\n         /// This and Arguments.\n         /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n\t\t/// <typeparam name=\"T9\">The type of the Argument 9.</typeparam>\n\t\t/// <typeparam name=\"T10\">The type of the Argument 10.</typeparam>\n\t\t/// <typeparam name=\"T11\">The type of the Argument 11.</typeparam>\n\t\t/// <typeparam name=\"T12\">The type of the Argument 12.</typeparam>\n\t\t/// <typeparam name=\"T13\">The type of the Argument 13.</typeparam>\n\t\t/// <typeparam name=\"T14\">The type of the Argument 14.</typeparam>\n\t\t/// <typeparam name=\"T15\">The type of the Argument 15.</typeparam>\n         /// <param name=\"del\">The del.</param>\n         /// <returns></returns>\n         public static ThisAction<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15> ThisAndArguments<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15>(ThisAction<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15> del)\n         {\n             return del;\n         }\n\n\t\t \n\t\t\n        /// <summary>\n        /// Arguments\n        /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n\t\t/// <typeparam name=\"T9\">The type of the Argument 9.</typeparam>\n\t\t/// <typeparam name=\"T10\">The type of the Argument 10.</typeparam>\n\t\t/// <typeparam name=\"T11\">The type of the Argument 11.</typeparam>\n\t\t/// <typeparam name=\"T12\">The type of the Argument 12.</typeparam>\n\t\t/// <typeparam name=\"T13\">The type of the Argument 13.</typeparam>\n\t\t/// <typeparam name=\"T14\">The type of the Argument 14.</typeparam>\n\t\t/// <typeparam name=\"T15\">The type of the Argument 15.</typeparam>\n\t\t/// <typeparam name=\"T16\">The type of the Argument 16.</typeparam>\n        /// <param name=\"del\">The lambda.</param>\n        /// <returns>The lambda.</returns>\n\t\t public static Action<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16> Arguments<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>(Action<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16> del)\n        {\n            return del;\n        }\n\n\n         /// <summary>\n         /// This and Arguments.\n         /// </summary>\n\t\t/// <typeparam name=\"T1\">The type of the Argument 1.</typeparam>\n\t\t/// <typeparam name=\"T2\">The type of the Argument 2.</typeparam>\n\t\t/// <typeparam name=\"T3\">The type of the Argument 3.</typeparam>\n\t\t/// <typeparam name=\"T4\">The type of the Argument 4.</typeparam>\n\t\t/// <typeparam name=\"T5\">The type of the Argument 5.</typeparam>\n\t\t/// <typeparam name=\"T6\">The type of the Argument 6.</typeparam>\n\t\t/// <typeparam name=\"T7\">The type of the Argument 7.</typeparam>\n\t\t/// <typeparam name=\"T8\">The type of the Argument 8.</typeparam>\n\t\t/// <typeparam name=\"T9\">The type of the Argument 9.</typeparam>\n\t\t/// <typeparam name=\"T10\">The type of the Argument 10.</typeparam>\n\t\t/// <typeparam name=\"T11\">The type of the Argument 11.</typeparam>\n\t\t/// <typeparam name=\"T12\">The type of the Argument 12.</typeparam>\n\t\t/// <typeparam name=\"T13\">The type of the Argument 13.</typeparam>\n\t\t/// <typeparam name=\"T14\">The type of the Argument 14.</typeparam>\n\t\t/// <typeparam name=\"T15\">The type of the Argument 15.</typeparam>\n\t\t/// <typeparam name=\"T16\">The type of the Argument 16.</typeparam>\n         /// <param name=\"del\">The del.</param>\n         /// <returns></returns>\n         public static ThisAction<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16> ThisAndArguments<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16>(ThisAction<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16> del)\n         {\n             return del;\n         }\n\n\t\t      }\n}\n\n"
  },
  {
    "path": "Dynamitey/InlineLambdas.tt",
    "content": "﻿<#@ template language=\"C#\" #>\n<#@ output extension=\"cs\" #>\n//  Copyright 2010  Ekon Benefits\n// \n//    Licensed under the Apache License, Version 2.0 (the \"License\");\n//    you may not use this file except in compliance with the License.\n//    You may obtain a copy of the License at\n// \n//        http://www.apache.org/licenses/LICENSE-2.0\n// \n//    Unless required by applicable law or agreed to in writing, software\n//    distributed under the License is distributed on an \"AS IS\" BASIS,\n//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//    See the License for the specific language governing permissions and\n//    limitations under the License.\n\nusing System;\nusing System.Linq;\n\nnamespace Dynamitey\n{\n\n    /// <summary>\n    /// Fluent Class for writing inline lambdass\n    /// </summary>\n    /// <typeparam name=\"TR\">The type of the R.</typeparam>\n    public static class Return<TR>\n    {\n\t\t\n\t\t/// <summary>\n        /// Arguments\n        /// </summary>\n        /// <param name=\"del\">The lambda.</param>\n        /// <returns>The lambda.</returns>\n        public static Func<TR> Arguments(Func<TR> del)\n        {\n            return del;\n        }\n\n\n        /// <summary>\n        /// This and arguments.\n        /// </summary>\n        /// <param name=\"del\">The del.</param>\n        /// <returns></returns>\n        public static ThisFunc<TR> ThisAndArguments(ThisFunc<TR> del)\n        {\n            return del;\n        }\n\n\t\t<#for(int i=1; i<=16;i++){ #>\n\n\t\t<#\n\t\t\tvar tFuncTArgs =\"T1\";\n\t\t\tfor(int j=2;j<=i;j++){ \n\t\t\t\ttFuncTArgs +=String.Format(\",T{0}\",j);\n\t\t\t}\n\n\t\t#>\n\n\n        /// <summary>\n        /// Arguments \n        /// </summary>\n<# for(int j=1;j<=i;j++){ #>\n\t\t/// <typeparam name=\"T<#=j#>\">The type of the Argument <#=j#>.</typeparam>\n<# } #>\n        /// <param name=\"del\">The lambdas.</param>\n        /// <returns></returns>\n        public static Func<<#=tFuncTArgs#>,TR> Arguments<<# Write(tFuncTArgs); #>>(Func<<#=tFuncTArgs#>,TR> del)\n        {\n            return del;\n        }\n\n        /// <summary>\n        /// this and Arguments.\n        /// </summary>\n<# for(int j=1;j<=i;j++){ #>\n\t\t/// <typeparam name=\"T<#=j#>\">The type of the Argument <#=j#>.</typeparam>\n<# } #>\n        /// <param name=\"del\">The del.</param>\n        /// <returns></returns>\n        public static ThisFunc<TR,<#=tFuncTArgs#>> ThisAndArguments<<# Write(tFuncTArgs); #>>(ThisFunc<TR,<#=tFuncTArgs#>> del)\n        {\n            return del;\n        }\n\n     <# } #>\n\t}\n\n\n\t/// <summary>\n    /// Fluent class for writing inline lambdas that return void\n    /// </summary>\n\tpublic static class ReturnVoid\n    { \n\t    /// <summary>\n        /// Arguments\n        /// </summary>\n        /// <param name=\"del\">The lambda.</param>\n        /// <returns>The lambda.</returns>\n        public static Action Arguments(Action del)\n        {\n            return del;\n        }\n\n\n        /// <summary>\n        /// This and arguments.\n        /// </summary>\n        /// <param name=\"del\">The del.</param>\n        /// <returns></returns>\n        public static ThisAction ThisAndArguments(ThisAction del)\n        {\n            return del;\n        }\n\n\n\t\t<#for(int i=1; i<=16;i++){ #>\n\n\t\t<#\n\t\t\tvar tFuncTArgs =\"T1\";\n\t\t\tfor(int j=2;j<=i;j++){ \n\t\t\t\ttFuncTArgs +=String.Format(\",T{0}\",j);\n\t\t\t}\n\n\t\t#>\n\n        /// <summary>\n        /// Arguments\n        /// </summary>\n<# for(int j=1;j<=i;j++){ #>\n\t\t/// <typeparam name=\"T<#=j#>\">The type of the Argument <#=j#>.</typeparam>\n<# } #>\n        /// <param name=\"del\">The lambda.</param>\n        /// <returns>The lambda.</returns>\n\t\t public static Action<<#=tFuncTArgs#>> Arguments<<#=tFuncTArgs#>>(Action<<#=tFuncTArgs#>> del)\n        {\n            return del;\n        }\n\n\n         /// <summary>\n         /// This and Arguments.\n         /// </summary>\n<# for(int j=1;j<=i;j++){ #>\n\t\t/// <typeparam name=\"T<#=j#>\">The type of the Argument <#=j#>.</typeparam>\n<# } #>\n         /// <param name=\"del\">The del.</param>\n         /// <returns></returns>\n         public static ThisAction<<#=tFuncTArgs#>> ThisAndArguments<<#=tFuncTArgs#>>(ThisAction<<#=tFuncTArgs#>> del)\n         {\n             return del;\n         }\n\n\t\t <# } #>\n     }\n}\n\n"
  },
  {
    "path": "Dynamitey/Internal/Compat/Net40.cs",
    "content": "﻿\n\n\n\nnamespace Dynamitey.Internal.Compat\n{\n\n    using System;\n    using System.Collections.Generic;\n    using System.Reflection;\n    using System.Text;\n    using System.Globalization;\n    using System.Threading;\n\n    public static class Net40\n    {\n#if NETFRAMEWORK || PROFILE158\n\n        public static Type GetTypeInfo(this Type type)\n        {\n            return type;\n        }\n\n        public static MethodInfo GetMethodInfo(this Delegate del)\n        {\n            return del.Method;\n        }\n\n       public static CultureInfo GetDefaultThreadCurrentCulture() {\n            return Thread.CurrentThread.CurrentCulture;\n\n       }\n#else\n        public static CultureInfo GetDefaultThreadCurrentCulture() {\n\n            return CultureInfo.DefaultThreadCurrentCulture;\n\n        }\n\n#endif\n\n\n    }\n\n}\n\n"
  },
  {
    "path": "Dynamitey/Internal/Curry.cs",
    "content": "﻿// \n//  Copyright 2011 Ekon Benefits\n// \n//    Licensed under the Apache License, Version 2.0 (the \"License\");\n//    you may not use this file except in compliance with the License.\n//    You may obtain a copy of the License at\n// \n//        http://www.apache.org/licenses/LICENSE-2.0\n// \n//    Unless required by applicable law or agreed to in writing, software\n//    distributed under the License is distributed on an \"AS IS\" BASIS,\n//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//    See the License for the specific language governing permissions and\n//    limitations under the License.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Dynamic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing Dynamitey.Internal.Optimization;\n\nusing System.Reflection;\n\nnamespace Dynamitey.Internal\n{\n    /// <summary>\n    /// Internal Implementation of <see cref=\"Dynamic.Curry(object,System.Nullable{int})\"/>\n    /// </summary>\n    public class Curry : DynamicObject, IPartialApply\n        {\n\n            /// <summary>\n            /// Pipe argument (left side) into curried function (right side)\n            /// </summary>\n            /// <param name=\"argument\">The argument.</param>\n            /// <param name=\"function\">The function.</param>\n            /// <returns></returns>\n            public static dynamic operator |(dynamic argument, Curry function)\n            {\n                return ((dynamic)function)(argument);\n            }\n\n            private readonly object _target;\n            private readonly int? _totalArgCount;\n           \n\n            internal Curry(object target, int? totalArgCount=null)\n             {\n                 _target = target;\n                _totalArgCount = totalArgCount;\n             }\n\n\n\n            /// <summary>\n            /// Provides implementation for binary operations. Classes derived from the <see cref=\"T:System.Dynamic.DynamicObject\" /> class can override this method to specify dynamic behavior for operations such as addition and multiplication.\n            /// </summary>\n            /// <param name=\"binder\">Provides information about the binary operation. The binder.Operation property returns an <see cref=\"T:System.Linq.Expressions.ExpressionType\" /> object. For example, for the sum = first + second statement, where first and second are derived from the DynamicObject class, binder.Operation returns ExpressionType.Add.</param>\n            /// <param name=\"arg\">The right operand for the binary operation. For example, for the sum = first + second statement, where first and second are derived from the DynamicObject class, <paramref name=\"arg\" /> is equal to second.</param>\n            /// <param name=\"result\">The result of the binary operation.</param>\n            /// <returns>\n            /// true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.)\n            /// </returns>\n            public override bool TryBinaryOperation(BinaryOperationBinder binder, object arg, out object result)\n            {\n                result = null;\n                if (binder.Operation == ExpressionType.LeftShift)\n                {\n                    result =((dynamic)(this))(arg);\n                    return true;\n                }\n                return false;\n            }\n\n            /// <summary>\n            /// Provides implementation for type conversion operations. Classes derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class can override this method to specify dynamic behavior for operations that convert an object from one type to another.\n            /// </summary>\n            /// <param name=\"binder\">Provides information about the conversion operation. The binder.Type property provides the type to which the object must be converted. For example, for the statement (String)sampleObject in C# (CType(sampleObject, Type) in Visual Basic), where sampleObject is an instance of the class derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class, binder.Type returns the <see cref=\"T:System.String\"/> type. The binder.Explicit property provides information about the kind of conversion that occurs. It returns true for explicit conversion and false for implicit conversion.</param>\n            /// <param name=\"result\">The result of the type conversion operation.</param>\n            /// <returns>\n            /// true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.)\n            /// </returns>\n            public override bool TryConvert(ConvertBinder binder, out object result)\n            {\n                result = Dynamic.CoerceToDelegate(this, binder.Type);\n\n                return result != null;\n            }\n\n\n#if SILVERLIGHT5\n\n        /// <summary>\n        /// Gets the custom Type.\n        /// </summary>\n        /// <returns></returns>\n        public Type GetCustomType()\n        {\n            return this.GetDynamicCustomType();\n        }\n#endif\n\n            /// <summary>\n            /// Provides the implementation for operations that invoke a member. Classes derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class can override this method to specify dynamic behavior for operations such as calling a method.\n            /// </summary>\n            /// <param name=\"binder\">Provides information about the dynamic operation. The binder.Name property provides the name of the member on which the dynamic operation is performed. For example, for the statement sampleObject.SampleMethod(100), where sampleObject is an instance of the class derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class, binder.Name returns \"SampleMethod\". The binder.IgnoreCase property specifies whether the member name is case-sensitive.</param>\n            /// <param name=\"args\">The arguments that are passed to the object member during the invoke operation. For example, for the statement sampleObject.SampleMethod(100), where sampleObject is derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class, <paramref name=\"args\"/>[0] is equal to 100.</param>\n            /// <param name=\"result\">The result of the member invocation.</param>\n            /// <returns>\n            /// true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.)\n            /// </returns>\n           public override bool  TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result)\n           {\n               result = new PartialApply(_target, Util.NameArgsIfNecessary(binder.CallInfo, args), binder.Name, _totalArgCount);\n               return true;\n           }\n           /// <summary>\n           /// Provides the implementation for operations that invoke an object. Classes derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class can override this method to specify dynamic behavior for operations such as invoking an object or a delegate.\n           /// </summary>\n           /// <param name=\"binder\">Provides information about the invoke operation.</param>\n           /// <param name=\"args\">The arguments that are passed to the object during the invoke operation. For example, for the sampleObject(100) operation, where sampleObject is derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class, <paramref name=\"args\"/>[0] is equal to 100.</param>\n           /// <param name=\"result\">The result of the object invocation.</param>\n           /// <returns>\n           /// true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.\n           /// </returns>\n            public override bool  TryInvoke(InvokeBinder binder, object[] args, out object result)\n            {\n                var tCurrying = _target as PartialApply;\n\n                \n               var  curryResult = tCurrying != null\n                             //If already currying append\n                             ? new PartialApply(tCurrying.Target,\n                                            tCurrying.Args.Concat(Util.NameArgsIfNecessary(binder.CallInfo, args)).\n                                                ToArray(), tCurrying.MemberName, tCurrying.TotalArgCount, tCurrying.InvocationKind)\n                             : new PartialApply(_target, Util.NameArgsIfNecessary(binder.CallInfo, args), String.Empty, _totalArgCount);\n\n\n               result = curryResult;\n               if (args.Length == curryResult.TotalArgCount)\n                   result= ((dynamic) curryResult)();\n               return true;\n           }\n        }\n\n\n     \n\n}\n"
  },
  {
    "path": "Dynamitey/Internal/InvokeSetters.cs",
    "content": "﻿using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Dynamic;\nusing System.Linq;\nusing Dynamitey.Internal.Optimization;\nusing Microsoft.CSharp.RuntimeBinder;\nusing Dynamitey.Internal.Compat;\nusing System.Reflection;\n\nnamespace Dynamitey.Internal\n{\n    /// <summary>\n    /// Internal class implmenation for <see cref=\"Dynamic.InvokeSetAll\"/>\n    /// </summary>\n    public class InvokeSetters : DynamicObject\n    {\n        internal InvokeSetters()\n        {\n\n        }\n\n        /// <summary>\n        /// Provides the implementation for operations that invoke an object. Classes derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class can override this method to specify dynamic behavior for operations such as invoking an object or a delegate.\n        /// </summary>\n        /// <param name=\"binder\">Provides information about the invoke operation.</param>\n        /// <param name=\"args\">The arguments that are passed to the object during the invoke operation. For example, for the sampleObject(100) operation, where sampleObject is derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class, <paramref name=\"args\"/>[0] is equal to 100.</param>\n        /// <param name=\"result\">The result of the object invocation.</param>\n        /// <returns>\n        /// true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.\n        /// </returns>\n        public override bool TryInvoke(InvokeBinder binder, object[] args, out object result)\n        {\n            IEnumerable<KeyValuePair<string, object>> tDict = null;\n            object target = null;\n            result = null;\n\n            //Setup Properties as dictionary\n            if (binder.CallInfo.ArgumentNames.Any())\n            {\n                \n                if (binder.CallInfo.ArgumentNames.Count + 1 == binder.CallInfo.ArgumentCount)\n                {\n                    target = args.First();\n                    tDict = binder.CallInfo.ArgumentNames\n                        .Zip(args.Skip(1), (key, value) => new { key, value })\n                        .ToDictionary(k => k.key, v => v.value);\n\n                }else\n                {\n                    throw new RuntimeBinderException(\"InvokeSetAll requires first parameter to be target unamed, and all other parameters to be named.\");\n                }\n            }\n            else if (args.Length == 2)\n            {\n                target = args[0];\n                if (args[1] is IEnumerable<KeyValuePair<string, object>>)\n                {\n                    tDict = (IEnumerable<KeyValuePair<string, object>>)args[1];\n                }\n                else if (args[1] is IEnumerable\n                        && args[1].GetType().GetTypeInfo().IsGenericType\n                    )\n                {\n                    var tEnumerableArg = (IEnumerable)args[1];\n\n                    var tInterface = tEnumerableArg.GetType().GetTypeInfo().GetInterfaces().FirstOrDefault(it=>it.Name ==\"IEnumerable`1\");\n                    if(tInterface !=null)\n                    {\n                        var tParamTypes = tInterface.GetTypeInfo().GetGenericArguments();\n                        if(tParamTypes.Length ==1 \n                            && tParamTypes[0].GetGenericTypeDefinition() == typeof(Tuple<,>))\n                        {\n                           tDict= tEnumerableArg.Cast<dynamic>().ToDictionary(k => (string) k.Item1, v => (object) v.Item2);\n                        }\n                    }\n                }\n                else if (Util.IsAnonymousType(args[1]))\n                {\n                    var keyDict = new Dictionary<string, object>();\n                    foreach (var tProp in args[1].GetType().GetTypeInfo().GetProperties())\n                    {\n                        keyDict[tProp.Name] = Dynamic.InvokeGet(args[1], tProp.Name);\n                    }\n                    tDict = keyDict;\n                }\n            }\n            //Invoke all properties\n            if (target != null && tDict != null)\n            {\n                foreach (var tPair in tDict)\n                {\n                    Dynamic.InvokeSetChain(target, tPair.Key, tPair.Value);\n                }\n                result = target;\n                return true;\n            }\n            return false;\n        }\n    }\n}\n"
  },
  {
    "path": "Dynamitey/Internal/Optimization/BareBonesList.cs",
    "content": "﻿// \n//  Copyright 2011 Ekon Benefits\n// \n//    Licensed under the Apache License, Version 2.0 (the \"License\");\n//    you may not use this file except in compliance with the License.\n//    You may obtain a copy of the License at\n// \n//        http://www.apache.org/licenses/LICENSE-2.0\n// \n//    Unless required by applicable law or agreed to in writing, software\n//    distributed under the License is distributed on an \"AS IS\" BASIS,\n//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//    See the License for the specific language governing permissions and\n//    limitations under the License.\n\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\n\nnamespace Dynamitey.Internal.Optimization\n{\n    internal class BareBonesList<T>: ICollection<T>\n    {\n        private T[] _list;\n        private int _addIndex;\n   \n        private int _length;\n\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"BareBonesList&lt;T&gt;\"/> class.\n        /// </summary>\n        /// <param name=\"length\">The max length that the list cannot grow beyound</param>\n        public BareBonesList(int length)\n        {\n            _list = new T[length];\n            _length = length;\n        }\n\n        public void Add(T item)\n        {\n            _list[_addIndex++] = item;\n        }\n\n        public void Clear()\n        {\n            throw new NotSupportedException();\n        }\n\n        public bool Contains(T item)\n        {\n            throw new NotSupportedException();\n        }\n\n        public void CopyTo(T[] array, int arrayIndex)\n        {\n            Array.Copy(_list,arrayIndex,array,0,_length);\n        }\n\n        public bool Remove(T item)\n        {\n            throw new NotSupportedException();\n        }\n\n        public int Count => _length;\n\n        public bool IsReadOnly => false;\n\n        /// <summary>\n        /// Gets the enumerator. with bare bones this is good only once\n        /// </summary>\n        /// <returns></returns>\n        public IEnumerator<T> GetEnumerator()\n        {\n            return new BareBonesEnumerator(_list,_addIndex);\n        }\n\n        IEnumerator IEnumerable.GetEnumerator()\n        {\n            return GetEnumerator();\n        }\n\n\n        internal class BareBonesEnumerator : IEnumerator<T>\n\n        {\n            private T[] _list;\n            private int _enumerateInex = -1;\n            private int _length;\n\n            public BareBonesEnumerator(T[] list, int length)\n            {\n                _list = list;\n                _length = length;\n            }\n\n            public void Dispose()\n            {\n\n            }\n\n            public bool MoveNext()\n            {\n                _enumerateInex++;\n                return _enumerateInex < _length;\n            }\n\n            public void Reset()\n            {\n                _enumerateInex = 0;\n            }\n\n            public T Current => _list[_enumerateInex];\n\n            object IEnumerator.Current => Current;\n        }\n    \n    }\n\n \n}"
  },
  {
    "path": "Dynamitey/Internal/Optimization/BinderHash.cs",
    "content": "﻿// \n//  Copyright 2011 Ekon Benefits\n// \n//    Licensed under the Apache License, Version 2.0 (the \"License\");\n//    you may not use this file except in compliance with the License.\n//    You may obtain a copy of the License at\n// \n//        http://www.apache.org/licenses/LICENSE-2.0\n// \n//    Unless required by applicable law or agreed to in writing, software\n//    distributed under the License is distributed on an \"AS IS\" BASIS,\n//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//    See the License for the specific language governing permissions and\n//    limitations under the License.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Dynamitey.Internal.Optimization\n{\n    internal class BinderHash\n    {\n   \n\n        protected BinderHash(Type delegateType, String name, Type context, string[] argNames, Type binderType, bool staticContext, bool isEvent, bool knownBinder)\n        {\n            KnownBinder = knownBinder;\n            BinderType = binderType;\n            StaticContext = staticContext;\n            DelegateType = delegateType;\n            Name = name;\n            IsSpecialName = false;\n            GenericArgs = null;\n            Context = context;\n            ArgNames = argNames;\n            IsEvent = isEvent;\n            \n\n        }\n\n        protected BinderHash(Type delegateType, InvokeMemberName name, Type context, string[] argNames, Type binderType, bool staticContext, bool isEvent, bool knownBinder)\n        {\n            KnownBinder = knownBinder;\n            BinderType = binderType;\n            StaticContext = staticContext;\n            DelegateType = delegateType;\n            Name = name.Name;\n            IsSpecialName = name.IsSpecialName;\n            GenericArgs = name.GenericArgs;\n            Context = context;\n            ArgNames = argNames;\n            IsEvent = isEvent;\n\n\n        }\n\n\n \n\n        public bool KnownBinder { get; }\n        public Type BinderType { get;  }\n        public bool StaticContext { get; }\n        public bool IsEvent { get;  }\n        public Type DelegateType { get; }\n        public string Name { get;  }\n        public bool IsSpecialName { get; }\n        public Type[] GenericArgs { get;  }\n        public Type Context { get; }\n        public string[] ArgNames { get; }\n\n        public virtual bool Equals(BinderHash other)\n        {\n            if (ReferenceEquals(null, other)) return false;\n            if (ReferenceEquals(this, other)) return true;\n\n            var tArgNames = ArgNames;\n            var tOtherArgNames = other.ArgNames;\n            var tGenArgs = GenericArgs;\n            var tOtherGenArgs = other.GenericArgs;\n\n            return\n                !(tOtherArgNames == null && tArgNames != null)\n                && !(tArgNames == null && tOtherArgNames != null)\n                && other.IsEvent == IsEvent\n                && other.StaticContext == StaticContext\n                && other.Context == Context\n                && (KnownBinder || other.BinderType == BinderType)\n                && other.DelegateType == DelegateType\n                && Equals(other.Name, Name)\n                && !(other.IsSpecialName ^ IsSpecialName)\n                && !(tOtherGenArgs == null && tGenArgs != null)\n                && !(tGenArgs == null && tOtherGenArgs != null)\n                && (tOtherGenArgs == null || tOtherGenArgs.SequenceEqual(tGenArgs))\n                && (tOtherArgNames == null || tOtherArgNames.SequenceEqual(tArgNames));\n        }\n\n\n        public override bool Equals(object obj)\n        {\n            if (ReferenceEquals(null, obj)) return false;\n            if (ReferenceEquals(this, obj)) return true;\n            if (!(obj is BinderHash)) return false;\n            return Equals((BinderHash) obj);\n        }\n\n        public override int GetHashCode()\n        {\n            unchecked\n            {\n                var tArgNames = ArgNames;\n\n                int result = (tArgNames == null ? 0 : tArgNames.Length * 397);\n                result = (result  ^ StaticContext.GetHashCode());\n                //result = (result * 397) ^ DelegateType.GetHashCode();\n                //result = (result * 397) ^ Context.GetHashCode();\n                result = (result * 397) ^ Name.GetHashCode();\n                return result;\n            }\n        }\n    }\n\n\n\n    internal class BinderHash<T> : BinderHash where T : class\n    {\n        public static BinderHash<T> Create(string name, Type context, string[] argNames, Type binderType, bool staticContext, bool isEvent, bool knownBinder)\n        {\n            return new BinderHash<T>(name, context, argNames, binderType, staticContext, isEvent, knownBinder);\n        }\n\n        public static BinderHash<T> Create(InvokeMemberName name, Type context, string[] argNames, Type binderType, bool staticContext, bool isEvent, bool knownBinder)\n        {\n            return new BinderHash<T>(name, context, argNames, binderType, staticContext, isEvent, knownBinder);\n        }\n\n        protected BinderHash(InvokeMemberName name, Type context, string[] argNames, Type binderType, bool staticContext, bool isEvent,bool knownBinder)\n            : base(typeof(T), name, context, argNames, binderType, staticContext, isEvent,knownBinder)\n        {\n        }\n\n        protected BinderHash(string name, Type context, string[] argNames, Type binderType, bool staticContext, bool isEvent, bool knownBinder)\n            : base(typeof(T), name, context, argNames, binderType, staticContext, isEvent, knownBinder)\n        {\n        }\n\n        public override bool Equals(BinderHash other)\n        {\n           \n                if (other is BinderHash<T>)\n                {\n                    var tGenArgs = GenericArgs;\n                    var tOtherGenArgs = other.GenericArgs;\n\n                    var tArgNames = ArgNames;\n                    var tOtherArgNames = other.ArgNames;\n                return\n                           !(tOtherArgNames == null && tArgNames != null)\n                           && !(tArgNames == null && tOtherArgNames != null)\n                           && other.IsEvent == IsEvent\n                           && other.StaticContext == StaticContext\n                           && (KnownBinder || other.BinderType == BinderType)\n                           && other.Context == Context\n                           && Equals(other.Name, Name)\n                           && !(other.IsSpecialName ^ IsSpecialName)\n                           && !(tOtherGenArgs == null && tGenArgs != null)\n                           && !(tGenArgs == null && tOtherGenArgs != null)\n                           && (tGenArgs == null || tGenArgs.SequenceEqual(tOtherGenArgs))\n                           && (ArgNames == null || other.ArgNames.SequenceEqual(ArgNames));\n                }\n                return false;\n            \n           \n        }\n    }\n}\n"
  },
  {
    "path": "Dynamitey/Internal/Optimization/InvokeHelper-Regular.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Dynamic;\nusing System.Linq;\nusing System.Reflection;\nusing System.Runtime.CompilerServices;\nusing Dynamitey.DynamicObjects;\nusing Microsoft.CSharp.RuntimeBinder;\nusing Binder = Microsoft.CSharp.RuntimeBinder.Binder;\nusing Dynamitey.Internal.Compat;\n\nnamespace Dynamitey.Internal.Optimization\n{\n\n    internal class DummmyNull\n    {\n\n    }\n\n\n    internal static partial class InvokeHelper\n    {\n\n        internal const int Unknown =0;\n        internal const int KnownGet = 1;\n        internal const int KnownSet = 2;\n        internal const int KnownMember = 3;\n        internal const int KnownDirect = 4;\n        internal const int KnownConstructor = 5;\n\n\n\n        private static readonly object _clearDynamicLock = new object();\n        internal static IDictionary<Type, CallSite<DynamicCreateCallSite>> DynamicInvokeCreateCallSite\n        {\n            get\n            {\n                lock (_clearDynamicLock)\n                {\n                    return _dynamicInvokeCreateCallSite ?? (_dynamicInvokeCreateCallSite =\n                               new Dictionary<Type, CallSite<DynamicCreateCallSite>>());\n                }\n\n            }\n        }\n\n        internal static void ClearFullyDynamicCache()\n        {\n            lock (_clearDynamicLock)\n            {\n                _dynamicInvokeCreateCallSite = null;\n            }\n        }\n\n        private static bool TryDynamicCachedCallSite<T>(BinderHash<T> hash, int knownBinderType, out CallSite<T> callSite) where T: class \n        {\n            switch(knownBinderType)\n            {\n                default:\n                    return BinderCache<T>.Cache.TryGetValue(hash, out callSite);\n\n                case KnownGet:\n                    return BinderGetCache<T>.Cache.TryGetValue(hash, out callSite);\n\n                case KnownSet:\n                    return BinderSetCache<T>.Cache.TryGetValue(hash, out callSite);\n\n                case KnownMember:\n                    return BinderMemberCache<T>.Cache.TryGetValue(hash, out callSite);\n\n                case KnownDirect:\n                    return BinderDirectCache<T>.Cache.TryGetValue(hash, out callSite);\n\n                case KnownConstructor:\n                    return BinderConstructorCache<T>.Cache.TryGetValue(hash, out callSite);\n                            \n            }\n\n        }\n\n\n\n\n        internal static readonly dynamic BuildProxy = new DynamicObjects.LateType(\n            \"ImpromptuInterface.Build.BuildProxy, ImpromptuInterface, PublicKeyToken=0b1781c923b2975b\");\n\n        internal static Type EmitCallSiteFuncType(IEnumerable<Type> argTypes, Type returnType)\n        {\n            try\n            {\n                //Impromptu Interface version 8.04\n                return BuildProxy.DefaultProxyMaker.EmitCallSiteFuncType(argTypes, returnType);\n            }\n            catch (LateType.MissingTypeException ex)\n            {  \n                try\n                {\n                    //Impromptu Interface 7.X\n                    return BuildProxy.EmitCallSiteFuncType(argTypes, returnType);\n                }\n                catch (LateType.MissingTypeException)\n                {\n                    throw new TypeLoadException(\"Cannot Emit long delegates without ImpromptuInterface installed\", ex);\n                }\n            }\n    \n        }\n\n        internal static HashSet<object> _allCaches = new HashSet<object>();\n        private static readonly object _binderCacheLock = new object();\n        private static readonly object _callSiteCacheLock = new object();\n        internal static IDictionary<Type, CallSite<DynamicCreateCallSite>> _dynamicInvokeCreateCallSite;\n\n\n        internal static void ClearAllCaches()\n        {\n            lock (_binderCacheLock)\n            {\n                foreach (Action instance in _allCaches)\n                {\n                    instance();\n                }\n            }\n\n            lock (_callSiteCacheLock)\n            {\n                ClearFullyDynamicCache();\n            }\n        }\n\n\n        private static void SetDynamicCachedCallSite<T>(BinderHash<T> hash, int knownBinderType, CallSite<T> callSite) where T: class \n        {\n            switch (knownBinderType)\n            {\n                default:\n                    _allCaches.Add(BinderCache<T>.ClearCache);\n                    BinderCache<T>.Cache[hash] = callSite;\n                    break;\n                case KnownGet:\n                    _allCaches.Add(BinderGetCache<T>.ClearCache);\n                    BinderGetCache<T>.Cache[hash] = callSite;\n                    break;\n                case KnownSet:\n                    _allCaches.Add(BinderSetCache<T>.ClearCache);\n                    BinderSetCache<T>.Cache[hash] = callSite;\n                    break;\n                case KnownMember:\n                    _allCaches.Add(BinderMemberCache<T>.ClearCache);\n                    BinderMemberCache<T>.Cache[hash] = callSite;\n                    break;\n                case KnownDirect:\n                    _allCaches.Add(BinderDirectCache<T>.ClearCache);\n                    BinderDirectCache<T>.Cache[hash] = callSite;\n                    break;\n                case KnownConstructor:\n                    _allCaches.Add(BinderConstructorCache<T>.ClearCache);\n                    BinderConstructorCache<T>.Cache[hash] = callSite;\n                    break;\n            }\n        }\n\n      \n\n        /// <summary>\n        /// LazyBinderType\n        /// </summary>\n        internal delegate CallSiteBinder LazyBinder();\n\n\n\n        public static bool IsActionOrFunc(object target)\n        {\n            if (target == null)\n                return false;\n            var tType = target as Type ?? target.GetType();\n\n            if (tType.GetTypeInfo().IsGenericType)\n            {\n                tType = tType.GetGenericTypeDefinition();\n            }\n\n            return FuncArgs.ContainsKey(tType) || ActionArgs.ContainsKey(tType);\n         }\n\n   \n\n        internal static object InvokeMethodDelegate(this object target, Delegate tFunc, object[] args)\n        {\n            object result;\n\n            try\n            {\n                result = tFunc.FastDynamicInvoke(\n                    tFunc.IsSpecialThisDelegate()\n                        ? new[] { target }.Concat(args).ToArray()\n                        : args\n                    );\n            }\n            catch (TargetInvocationException ex)\n            {\n                if (ex.InnerException != null)\n                    throw ex.InnerException;\n                throw;\n            }\n            return result;\n        }\n\n\n\n        internal static IEnumerable<CSharpArgumentInfo> GetBindingArgumentList(object[] args, string[] argNames, bool staticContext)\n        {\n\n            var tTargetFlag = CSharpArgumentInfoFlags.None;\n            if (staticContext)\n            {\n                tTargetFlag |= CSharpArgumentInfoFlags.IsStaticType | CSharpArgumentInfoFlags.UseCompileTimeType;\n            }\n\n\n\n            var tList = new BareBonesList<CSharpArgumentInfo>(args.Length + 1)\n                        {\n                            CSharpArgumentInfo.Create(tTargetFlag, null)\n                        };\n\n            //Optimization: linq statement creates a slight overhead in this case\n            // ReSharper disable LoopCanBeConvertedToQuery\n            // ReSharper disable ForCanBeConvertedToForeach\n            for (int i = 0; i < args.Length; i++)\n            {\n                var tFlag = CSharpArgumentInfoFlags.None;\n                string tName = null;\n                if (argNames != null && argNames.Length > i)\n                    tName = argNames[i];\n\n                if (!String.IsNullOrEmpty(tName))\n                {\n                    tFlag |= CSharpArgumentInfoFlags.NamedArgument;\n\n                }\n                tList.Add(CSharpArgumentInfo.Create(\n                    tFlag, tName));\n            }\n            // ReSharper restore ForCanBeConvertedToForeach\n            // ReSharper restore LoopCanBeConvertedToQuery\n\n            return tList;\n        }\n\n\n\n\n  \n\n        internal static CallSite CreateCallSite(\n            Type delegateType,\n            Type specificBinderType,\n             int knownType,\n            LazyBinder binder,\n            InvokeMemberName name,\n            Type context,\n            string[] argNames = null,\n            bool staticContext = false,\n            bool isEvent = false\n           \n            )\n        {\n            CallSite<DynamicCreateCallSite> tSite;\n\n            bool foundInCache;\n\n            lock (_callSiteCacheLock)\n            {\n                foundInCache = DynamicInvokeCreateCallSite.TryGetValue(delegateType, out tSite);\n            }\n\n            if (!foundInCache)\n            {\n                tSite = CallSite<DynamicCreateCallSite>.Create(\n                    Binder.InvokeMember(\n                        CSharpBinderFlags.None,\n                        \"CreateCallSite\",\n                        new[] { delegateType },\n                        typeof(InvokeHelper),\n                        new[]\n                            {\n                                CSharpArgumentInfo.Create(\n                                    CSharpArgumentInfoFlags.IsStaticType | CSharpArgumentInfoFlags.UseCompileTimeType,\n                                    null), // InvokeHelper\n                                CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null), //binderType\n                                CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null), //knownType\n                                CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null), //binder\n                                CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null), //name\n                                CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null), //context\n                                CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null), //argnames\n                                CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null), //staticcontext\n                                CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null), //isevent\n                            }\n                        ));\n\n                lock (_callSiteCacheLock)\n                {\n                    // another thread might have been faster; add to dictionary only if we are the first\n                    if (!DynamicInvokeCreateCallSite.ContainsKey(delegateType))\n                    {\n                        DynamicInvokeCreateCallSite[delegateType] = tSite;\n                    }\n                }\n            }\n            return (CallSite)tSite.Target(tSite, typeof(InvokeHelper), specificBinderType, knownType, binder, name, context, argNames, staticContext, isEvent);\n        }\n\n        internal delegate object DynamicCreateCallSite(\n           CallSite site,\n           Type targetType,\n           Type specificBinderType, \n           int knownType,\n           LazyBinder binder,\n           InvokeMemberName name,\n           Type context,\n           string[] argNames,\n           bool staticContext,\n           bool isEvent\n       );\n\n\n\n        internal static CallSite<T> CreateCallSite<T>(\n        Type specificBinderType,\n        int knownType,\n        LazyBinder binder,\n        InvokeMemberName name,\n        Type context,\n        string[] argNames = null,\n        bool staticContext = false,\n        bool isEvent = false\n        )\n        where T : class\n        {\n            var tHash = BinderHash<T>.Create(name, context, argNames, specificBinderType, staticContext, isEvent, knownType != Unknown);\n            lock (_binderCacheLock)\n            {\n                if (!TryDynamicCachedCallSite(tHash, knownType, out var tOut))\n                {\n                    tOut = CallSite<T>.Create(binder());\n                    SetDynamicCachedCallSite(tHash, knownType, tOut);\n                }\n                return tOut;\n            }\n        }\n\n        internal static CallSite<T> CreateCallSite<T>(\n   Type specificBinderType,\n   int knownType,\n   LazyBinder binder,\n   string name,\n   Type context,\n   string[] argNames = null,\n   bool staticContext = false,\n   bool isEvent = false\n   )\n   where T : class\n        {\n            var tHash = BinderHash<T>.Create(name, context, argNames, specificBinderType, staticContext, isEvent, knownType != Unknown);\n            lock (_binderCacheLock)\n            {\n                if (!TryDynamicCachedCallSite(tHash, knownType, out var tOut))\n                {\n                    tOut = CallSite<T>.Create(binder());\n                    SetDynamicCachedCallSite(tHash, knownType, tOut);\n                }\n                return tOut;\n            }\n        }\n\n\n        internal delegate object DynamicInvokeMemberConstructorValueType(\n            CallSite funcSite,\n            Type funcTarget,\n            ref CallSite callsite,\n            Type binderType,\n            int knownType,\n            LazyBinder binder,\n            InvokeMemberName name,\n            bool staticContext,\n            Type context,\n            string[] argNames,\n            Type target,\n            object[] args);\n\n        internal static readonly IDictionary<Type, CallSite<DynamicInvokeMemberConstructorValueType>> _dynamicInvokeMemberSite = new Dictionary<Type, CallSite<DynamicInvokeMemberConstructorValueType>>();\n\n        internal static dynamic DynamicInvokeStaticMember(Type tReturn, ref CallSite callsite, Type binderType, int knownType, LazyBinder binder,\n                                       InvokeMemberName name,\n                                     bool staticContext,\n                                     Type context,\n                                     string[] argNames,\n                                     Type target, params object[] args)\n        {\n            if (!_dynamicInvokeMemberSite.TryGetValue(tReturn, out var tSite))\n            {\n                tSite = CallSite<DynamicInvokeMemberConstructorValueType>.Create(\n                        Binder.InvokeMember(\n                            CSharpBinderFlags.None,\n                            \"InvokeMemberTargetType\",\n                            new[] { typeof(Type), tReturn },\n                            typeof(InvokeHelper),\n                            new[]\n                                {\n                                    CSharpArgumentInfo.Create(\n                                        CSharpArgumentInfoFlags.IsStaticType |\n                                        CSharpArgumentInfoFlags.UseCompileTimeType, null),\n                                     CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType | CSharpArgumentInfoFlags.IsRef, null),\n                                    CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null),\n                                    CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null),\n                                    CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null),\n                                    CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null),\n                                    CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null),\n                                    CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null),\n                                    CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null),\n                                    CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null),\n                                    CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null),\n                                }\n                            )\n                    );\n                _dynamicInvokeMemberSite[tReturn] = tSite;\n            }\n\n            return tSite.Target(tSite, typeof(InvokeHelper), ref callsite, binderType, knownType, binder, name, staticContext, context, argNames, target, args);\n        }\n\n\n        internal static TReturn InvokeMember<TReturn>(ref CallSite callsite, Type binderType,int knownType, LazyBinder binder,\n                                       InvokeMemberName name,\n                                     bool staticContext,\n                                     Type context,\n                                     string[] argNames,\n                                     object target, params object[] args)\n        {\n            return InvokeMemberTargetType<object, TReturn>(ref callsite, binderType, knownType, binder, name, staticContext, context, argNames, target, args);\n        }\n\n        internal static object InvokeGetCallSite(object target, string name, Type context, bool staticContext, ref CallSite callsite)\n        {\n            if (callsite == null)\n            {\n                var tTargetFlag = CSharpArgumentInfoFlags.None;\n                LazyBinder tBinder;\n                Type tBinderType;\n                int tKnownType;\n                if (staticContext) //CSharp Binder won't call Static properties, grrr.\n                {\n                    var tStaticFlag = CSharpBinderFlags.None;\n                    if ((target is Type && ((Type)target).GetTypeInfo().IsPublic))\n                    {\n                        tBinder = () => Binder.InvokeMember(tStaticFlag, \"get_\" + name,\n                                                            null,\n                                                            context,\n                                                            new List<CSharpArgumentInfo>\n                                                                {\n                                                                    CSharpArgumentInfo.Create(\n                                                                        CSharpArgumentInfoFlags.IsStaticType |\n                                                                        CSharpArgumentInfoFlags.UseCompileTimeType,\n                                                                        null)\n                                                                });\n\n                        tBinderType = typeof (InvokeMemberBinder);\n                        tKnownType = KnownMember;\n                    }\n                    else\n                    {\n\n                        tBinder = () => Binder.GetMember(tStaticFlag, name,\n                                                            context,\n                                                            new List<CSharpArgumentInfo>\n                                                                {\n                                                                    CSharpArgumentInfo.Create(\n                                                                        CSharpArgumentInfoFlags.IsStaticType,                                                                        null)\n                                                                });\n\n                        tBinderType = typeof(InvokeMemberBinder);\n                        tKnownType = KnownMember;\n                    }\n                }\n                else\n                {\n\n                    tBinder =()=> Binder.GetMember(CSharpBinderFlags.None, name,\n                                                      context,\n                                                      new List<CSharpArgumentInfo>\n                                                          {\n                                                              CSharpArgumentInfo.Create(\n                                                                  tTargetFlag, null)\n                                                          });\n                    tBinderType = typeof(GetMemberBinder);\n                    tKnownType = KnownGet;\n                }\n\n\n                callsite = CreateCallSite<Func<CallSite, object, object>>(tBinderType,tKnownType, tBinder, name, context,\n                                staticContext: staticContext);\n            }\n            var tCallSite = (CallSite<Func<CallSite, object, object>>) callsite;\n            return tCallSite.Target(tCallSite, target);\n            \n        }\n\n        internal static object InvokeSetCallSite(object target, string name, object value, Type context, bool staticContext, ref CallSite callSite)\n        {\n            if (callSite == null)\n            {\n                LazyBinder tBinder;\n                Type tBinderType;\n                if (staticContext) //CSharp Binder won't call Static properties, grrr.\n                {\n\n                    tBinder = () =>{\n                                    var tStaticFlag = CSharpBinderFlags.ResultDiscarded;\n\n                                      return Binder.InvokeMember(tStaticFlag, \"set_\" + name,\n                                                          null,\n                                                          context,\n                                                          new List<CSharpArgumentInfo>\n                                                              {\n                                                                  CSharpArgumentInfo.Create(\n                                                                      CSharpArgumentInfoFlags.IsStaticType |\n                                                                      CSharpArgumentInfoFlags.UseCompileTimeType, null),\n                                                                  CSharpArgumentInfo.Create(\n\n                                                                      CSharpArgumentInfoFlags.None\n\n                                                                      , null)\n                                                              });\n                                  };\n\n                    tBinderType = typeof(InvokeMemberBinder);\n                    callSite = CreateCallSite<Action<CallSite, object, object>>(tBinderType,KnownMember, tBinder, name, context, staticContext:true);\n                }\n                else\n                {\n\n                    tBinder = ()=> Binder.SetMember(CSharpBinderFlags.None, name,\n                                               context,\n                                               new List<CSharpArgumentInfo>\n                                                   {\n                                                       CSharpArgumentInfo.Create(\n                                                           CSharpArgumentInfoFlags.None, null),\n                                                       CSharpArgumentInfo.Create(\n\n                                                           CSharpArgumentInfoFlags.None\n\n                                                           , null)\n\n                                                   });\n\n\n                    tBinderType = typeof(SetMemberBinder);\n                    callSite = CreateCallSite<Func<CallSite, object, object, object>>(tBinderType,KnownSet, tBinder, name, context, staticContext: false);\n                }\n            }\n\n            if (staticContext)\n            {\n                var tCallSite = (CallSite<Action<CallSite, object, object>>) callSite;\n                tCallSite.Target(callSite, target, value);\n                return value;\n            }\n            else\n            {\n                var tCallSite = (CallSite<Func<CallSite, object, object, object>>) callSite;\n                var tResult = tCallSite.Target(callSite, target, value);\n                return tResult;\n            }\n        }\n\n        internal static object InvokeMemberCallSite(object target,  InvokeMemberName name, object[] args, string[] tArgNames, Type tContext, bool tStaticContext, ref CallSite callSite)\n        {\n            LazyBinder tBinder = null;\n            Type tBinderType = null;\n            if (callSite == null)\n            {\n              \n                tBinder = () =>\n                {\n                                var tList = GetBindingArgumentList(args, tArgNames, tStaticContext);\n                                var tFlag = CSharpBinderFlags.None;\n                                if (name.IsSpecialName)\n                                {\n                                    tFlag |= CSharpBinderFlags.InvokeSpecialName;\n                                }\n                                 return Binder.InvokeMember(tFlag, name.Name, name.GenericArgs,\n                                                             tContext, tList);\n                              };\n                tBinderType = typeof (InvokeMemberBinder);\n            }\n\n\n            return InvokeMember<object>(ref callSite, tBinderType, KnownMember, tBinder, name, tStaticContext, tContext, tArgNames, target, args);\n        }\n\n        internal static object InvokeDirectCallSite(object target, object[] args, string[] tArgNames, Type tContext, bool tStaticContext, ref CallSite callSite)\n        {\n            LazyBinder tBinder = null;\n            Type tBinderType = null;\n\n            if (callSite == null)\n            {\n\n                tBinder = () =>\n                {\n                    var tList = GetBindingArgumentList(args, tArgNames, tStaticContext);\n                    var tFlag = CSharpBinderFlags.None;\n                    return Binder.Invoke(tFlag,tContext, tList);\n                };\n                tBinderType = typeof(InvokeBinder);\n            }\n\n\n            return InvokeMember<object>(ref callSite, tBinderType, KnownDirect,tBinder, String.Empty, tStaticContext, tContext, tArgNames, target, args);\n        }\n\n        internal static object InvokeGetIndexCallSite(object target, object[] indexes, string[] argNames, Type context, bool tStaticContext,ref CallSite callSite)\n        {\n            LazyBinder tBinder=null;\n            Type tBinderType = null;\n            if (callSite == null)\n            {\n\n                tBinder = () =>\n                              {\n                                  var tList = GetBindingArgumentList(indexes, argNames,\n                                                                               tStaticContext);\n                                  return Binder.GetIndex(CSharpBinderFlags.None, context, tList);\n                              };\n                tBinderType = typeof (GetIndexBinder);\n\n            }\n\n            return InvokeMember<object>(ref callSite,tBinderType, Unknown, tBinder, Invocation.IndexBinderName, tStaticContext, context, argNames, target, indexes);\n        }\n\n        internal static object InvokeSetIndexCallSite(object target, object[] indexesThenValue, string[] tArgNames, Type tContext, bool tStaticContext, ref CallSite tCallSite)\n        {\n            LazyBinder tBinder =null;\n            Type tBinderType = null;\n            if (tCallSite == null)\n            {\n\n                tBinder = () =>\n                              {\n                                  var tList = GetBindingArgumentList(indexesThenValue, tArgNames,\n                                                                               tStaticContext);\n                                  return Binder.SetIndex(CSharpBinderFlags.None, tContext, tList);\n                              };\n\n                tBinderType = typeof (SetIndexBinder);\n            }\n\n            return InvokeMember<object>(ref tCallSite, tBinderType, Unknown, tBinder, Invocation.IndexBinderName, tStaticContext, tContext, tArgNames, target, indexesThenValue);\n        }\n\n        internal static void InvokeMemberActionCallSite(object target,InvokeMemberName name, object[] args, string[] tArgNames, Type tContext, bool tStaticContext,ref CallSite callSite)\n        {\n            LazyBinder tBinder =null;\n            Type tBinderType = null;\n            if (callSite == null)\n            {\n\n                tBinder = () =>\n                              {\n                                  IEnumerable<CSharpArgumentInfo> tList;\n                                  tList = GetBindingArgumentList(args, tArgNames, tStaticContext);\n\n                                  var tFlag = CSharpBinderFlags.ResultDiscarded;\n                                  if (name.IsSpecialName)\n                                  {\n                                      tFlag |= CSharpBinderFlags.InvokeSpecialName;\n                                  }\n\n                                  return Binder.InvokeMember(tFlag, name.Name, name.GenericArgs,\n                                                             tContext, tList);\n                              };\n                tBinderType = typeof (InvokeMemberBinder);\n            }\n\n\n            InvokeMemberAction(ref callSite,tBinderType, KnownMember, tBinder, name, tStaticContext, tContext, tArgNames, target, args);\n        }\n\n\n        internal static void InvokeDirectActionCallSite(object target, object[] args, string[] tArgNames, Type tContext, bool tStaticContext, ref CallSite callSite)\n        {\n            LazyBinder tBinder = null;\n            Type tBinderType = null;\n\n            if (callSite == null)\n            {\n\n                tBinder = () =>\n                {\n                    IEnumerable<CSharpArgumentInfo> tList;\n                    tList = GetBindingArgumentList(args, tArgNames, tStaticContext);\n\n                    var tFlag = CSharpBinderFlags.ResultDiscarded;\n                   \n\n                    return Binder.Invoke(tFlag,tContext, tList);\n                };\n                tBinderType = typeof(InvokeBinder);\n            }\n\n\n            InvokeMemberAction(ref callSite, tBinderType, KnownDirect, tBinder, String.Empty, tStaticContext, tContext, tArgNames, target, args);\n        }\n\n        internal class IsEventBinderDummy{\n            \n        }\n        internal static bool InvokeIsEventCallSite(object target, string name, Type tContext, ref CallSite callSite)\n        {\n            if (callSite == null)\n            {\n                LazyBinder tBinder = ()=> Binder.IsEvent(CSharpBinderFlags.None, name, tContext);\n                var tBinderType = typeof (IsEventBinderDummy);\n                callSite = CreateCallSite<Func<CallSite, object, bool>>(tBinderType, Unknown, tBinder, name, tContext, isEvent: true);\n            }\n            var tCallSite = (CallSite<Func<CallSite, object, bool>>)callSite;\n\n            return tCallSite.Target(tCallSite, target);\n        }\n\n        internal static void InvokeAddAssignCallSite(object target, string name, object[] args, string[] argNames, Type context, bool staticContext, //lgtm [cs/too-many-ref-parameters]\n            ref CallSite callSiteIsEvent, ref CallSite callSiteAdd, ref CallSite callSiteGet, ref CallSite callSiteSet) //This is an optimization readability isn't the concern. \n        {\n\n            if (InvokeIsEventCallSite(target, name, context, ref callSiteIsEvent))\n            {\n                InvokeMemberActionCallSite(target, InvokeMemberName.CreateSpecialName(\"add_\" + name), args, argNames, context, staticContext, ref callSiteAdd);\n            }\n            else\n            {\n                dynamic tGet = InvokeGetCallSite(target,name, context, staticContext, ref callSiteGet);\n                tGet += (dynamic)(args[0]);\n                InvokeSetCallSite(target, name,  (object)tGet, context, staticContext, ref callSiteSet);\n            }\n        }\n\n        internal static void InvokeSubtractAssignCallSite(object target, string name, object[] args, string[] argNames, Type context, bool staticContext, // lgtm [cs/too-many-ref-parameters]\n            ref CallSite callSiteIsEvent, ref CallSite callSiteRemove, ref CallSite callSiteGet, ref CallSite callSiteSet) //This is an optimization readability isn't the concern. \n        {\n            if (InvokeIsEventCallSite(target, name, context, ref callSiteIsEvent))\n            {\n                InvokeMemberActionCallSite(target, InvokeMemberName.CreateSpecialName(\"remove_\" + name), args, argNames, context, staticContext, ref callSiteRemove);\n            }\n            else\n            {\n                dynamic tGet = InvokeGetCallSite(target, name, context, staticContext, ref callSiteGet);\n                tGet -= (dynamic)(args[0]);\n                InvokeHelper.InvokeSetCallSite(target, name, tGet, context, staticContext, ref callSiteSet);\n            }\n        }\n\n        public delegate void DynamicAction(params object[] args);\n        public delegate TReturn DynamicFunc<out TReturn>(params object[] args);\n\n        internal static object InvokeConvertCallSite(object target, bool explict, Type type, Type context, ref CallSite callSite)\n        {\n            if (callSite == null) \n            {\n                LazyBinder tBinder = () =>\n                                         {\n                                             var tFlags = explict ? CSharpBinderFlags.ConvertExplicit : CSharpBinderFlags.None;\n\n                                             return Binder.Convert(tFlags, type, context);\n                                         };\n                Type tBinderType = typeof (ConvertBinder);\n\n                var tFunc = typeof(Func<,,>).MakeGenericType(typeof(CallSite), typeof(object), type);\n\n\n                callSite = CreateCallSite(tFunc, tBinderType,Unknown, tBinder,\n                                          explict\n                                              ? Invocation.ExplicitConvertBinderName\n                                              : Invocation.ImplicitConvertBinderName, context);\n            }\n            dynamic tDynCallSite = callSite;\n            return tDynCallSite.Target(callSite, target);\n\n        }\n\n        internal class InvokeConstructorDummy{};\n\n        internal static InvokeMemberName ConstructorName = new InvokeMemberName(Invocation.ConstructorBinderName);\n\n        internal static object InvokeConstructorCallSite(Type type, bool isValueType, object[] args, string[] argNames, ref CallSite callSite)\n        {\n            LazyBinder tBinder = null;\n            Type tBinderType  = typeof (InvokeConstructorDummy);\n            if (callSite == null || isValueType)\n            {\n                if (isValueType && args.Length == 0)  //dynamic invocation doesn't see no argument constructors of value types\n                {\n                    return Activator.CreateInstance(type);\n                }\n\n\n                tBinder = () =>\n                              {\n                                  var tList = GetBindingArgumentList(args, argNames, true);\n                                  return Binder.InvokeConstructor(CSharpBinderFlags.None, type, tList);\n                              };\n            }\n\n\n            if (isValueType)\n            {\n                CallSite tDummy =null;\n                return DynamicInvokeStaticMember(type, ref tDummy, tBinderType, KnownConstructor, tBinder, ConstructorName, true, type,\n                                                              argNames, type, args);\n            }\n\n            return InvokeMemberTargetType<Type, object>(ref callSite, tBinderType, KnownConstructor, tBinder, ConstructorName, true, type, argNames,\n                                                                     type, args);\n        }\n\n        internal static readonly IDictionary<Type, CallSite<DynamicInvokeWrapFunc>> _dynamicInvokeWrapFunc = new Dictionary<Type, CallSite<DynamicInvokeWrapFunc>>();\n\n        internal delegate object DynamicInvokeWrapFunc(\n         CallSite funcSite,\n         Type funcTarget,\n         object invokable,\n         int length\n         );\n\n        internal static Delegate WrapFunc(Type returnType, object invokable, int length)\n        {\n            if (!_dynamicInvokeWrapFunc.TryGetValue(returnType, out var tSite))\n            {\n\n                var tMethod =  \"WrapFuncHelper\";\n \n                tSite = CallSite<DynamicInvokeWrapFunc>.Create(\n                    Binder.InvokeMember(\n                        CSharpBinderFlags.None,\n                        tMethod,\n                        new[] {returnType},\n                        typeof (InvokeHelper),\n                        new[]\n                            {\n                                CSharpArgumentInfo.Create(\n                                    CSharpArgumentInfoFlags.IsStaticType | CSharpArgumentInfoFlags.UseCompileTimeType,\n                                    null),\n                                CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null),\n                                CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null),\n                            }\n                        )); \n                _dynamicInvokeWrapFunc[returnType] = tSite;\n            }\n            return (Delegate) tSite.Target(tSite, typeof(InvokeHelper), invokable, length);\n        }\n    }\n}\n"
  },
  {
    "path": "Dynamitey/Internal/Optimization/InvokeHelper.cs",
    "content": "﻿\n// \n//  Copyright 2011 Ekon Benefits\n// \n//    Licensed under the Apache License, Version 2.0 (the \"License\");\n//    you may not use this file except in compliance with the License.\n//    You may obtain a copy of the License at\n// \n//        http://www.apache.org/licenses/LICENSE-2.0\n// \n//    Unless required by applicable law or agreed to in writing, software\n//    distributed under the License is distributed on an \"AS IS\" BASIS,\n//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//    See the License for the specific language governing permissions and\n//    limitations under the License.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Reflection;\n\nnamespace Dynamitey.Internal.Optimization {\n\n\n    internal static class BinderCache<T> where T : class\n    {\n        private static IDictionary<BinderHash<T>, CallSite<T>> _cache;\n\n        private static readonly object _cacheLock = new object();\n\n        internal static IDictionary<BinderHash<T>, CallSite<T>> Cache\n        {\n            get\n            {\n                lock (_cacheLock)\n                {\n                    return _cache ?? (_cache = new Dictionary<BinderHash<T>, CallSite<T>>());\n                }\n            }\n        }\n\n        internal static readonly Action ClearCache = () =>\n        {\n            lock (_cacheLock)\n            {\n                _cache = null;\n            }\n        };\n    }\n    internal static class BinderGetCache<T> where T : class\n    {\n        private static IDictionary<BinderHash<T>, CallSite<T>> _cache;\n\n        private static readonly object _cacheLock = new object();\n\n        internal static IDictionary<BinderHash<T>, CallSite<T>> Cache\n        {\n            get\n            {\n                lock (_cacheLock)\n                {\n                    return _cache ?? (_cache = new Dictionary<BinderHash<T>, CallSite<T>>());\n                }\n            }\n        }\n\n        internal static readonly Action ClearCache = () =>\n        {\n            lock (_cacheLock)\n            {\n                _cache = null;\n            }\n        };\n    }\n    internal static class BinderSetCache<T> where T : class\n    {\n        private static IDictionary<BinderHash<T>, CallSite<T>> _cache;\n\n        private static readonly object _cacheLock = new object();\n\n        internal static IDictionary<BinderHash<T>, CallSite<T>> Cache\n        {\n            get\n            {\n                lock (_cacheLock)\n                {\n                    return _cache ?? (_cache = new Dictionary<BinderHash<T>, CallSite<T>>());\n                }\n            }\n        }\n\n        internal static readonly Action ClearCache = () =>\n        {\n            lock (_cacheLock)\n            {\n                _cache = null;\n            }\n        };\n    }\n    internal static class BinderConstructorCache<T> where T : class\n    {\n        private static IDictionary<BinderHash<T>, CallSite<T>> _cache;\n\n        private static readonly object _cacheLock = new object();\n\n        internal static IDictionary<BinderHash<T>, CallSite<T>> Cache\n        {\n            get\n            {\n                lock (_cacheLock)\n                {\n                    return _cache ?? (_cache = new Dictionary<BinderHash<T>, CallSite<T>>());\n                }\n            }\n        }\n\n        internal static readonly Action ClearCache = () =>\n        {\n            lock (_cacheLock)\n            {\n                _cache = null;\n            }\n        };\n    }\n    internal static class BinderMemberCache<T> where T : class\n    {\n        private static IDictionary<BinderHash<T>, CallSite<T>> _cache;\n\n        private static readonly object _cacheLock = new object();\n\n        internal static IDictionary<BinderHash<T>, CallSite<T>> Cache\n        {\n            get\n            {\n                lock (_cacheLock)\n                {\n                    return _cache ?? (_cache = new Dictionary<BinderHash<T>, CallSite<T>>());\n                }\n            }\n        }\n\n        internal static readonly Action ClearCache = () =>\n        {\n            lock (_cacheLock)\n            {\n                _cache = null;\n            }\n        };\n    }\n    internal static class BinderDirectCache<T> where T : class\n    {\n        private static IDictionary<BinderHash<T>, CallSite<T>> _cache;\n\n        private static readonly object _cacheLock = new object();\n\n        internal static IDictionary<BinderHash<T>, CallSite<T>> Cache\n        {\n            get\n            {\n                lock (_cacheLock)\n                {\n                    return _cache ?? (_cache = new Dictionary<BinderHash<T>, CallSite<T>>());\n                }\n            }\n        }\n\n        internal static readonly Action ClearCache = () =>\n        {\n            lock (_cacheLock)\n            {\n                _cache = null;\n            }\n        };\n    }\n\n    internal static partial class InvokeHelper\n    {\n\n\n        internal static readonly Type[] FuncKinds;\n        internal static readonly Type[] ActionKinds;\n\t\tinternal static readonly Type[] TupleKinds;\n\n\t\tinternal static readonly IDictionary<Type,int> FuncArgs;\n\t\tinternal static readonly IDictionary<Type,int> ActionArgs;\n\t\tinternal static readonly IDictionary<Type,int> TupleArgs;\n\n        static InvokeHelper()\n        {\n            FuncKinds = new []\n                            {\n\t\t\t\t\t\t\t\ttypeof(Func<>), //0\n\t\t\t\t\t\t\t\ttypeof(Func<,>), //1\n\t\t\t\t\t\t\t\ttypeof(Func<,,>), //2\n\t\t\t\t\t\t\t\ttypeof(Func<,,,>), //3\n\t\t\t\t\t\t\t\ttypeof(Func<,,,,>), //4\n\t\t\t\t\t\t\t\ttypeof(Func<,,,,,>), //5\n\t\t\t\t\t\t\t\ttypeof(Func<,,,,,,>), //6\n\t\t\t\t\t\t\t\ttypeof(Func<,,,,,,,>), //7\n\t\t\t\t\t\t\t\ttypeof(Func<,,,,,,,,>), //8\n\t\t\t\t\t\t\t\ttypeof(Func<,,,,,,,,,>), //9\n\t\t\t\t\t\t\t\ttypeof(Func<,,,,,,,,,,>), //10\n\t\t\t\t\t\t\t\ttypeof(Func<,,,,,,,,,,,>), //11\n\t\t\t\t\t\t\t\ttypeof(Func<,,,,,,,,,,,,>), //12\n\t\t\t\t\t\t\t\ttypeof(Func<,,,,,,,,,,,,,>), //13\n\t\t\t\t\t\t\t\ttypeof(Func<,,,,,,,,,,,,,,>), //14\n\t\t\t\t\t\t\t\ttypeof(Func<,,,,,,,,,,,,,,,>), //15\n\t\t\t\t\t\t\t\ttypeof(Func<,,,,,,,,,,,,,,,,>), //16\n                            };\n\n            ActionKinds = new []\n                            {\n                                typeof(Action), //0\n\t\t\t\t\t\t\t\ttypeof(Action<>), //1\n\t\t\t\t\t\t\t\ttypeof(Action<,>), //2\n\t\t\t\t\t\t\t\ttypeof(Action<,,>), //3\n\t\t\t\t\t\t\t\ttypeof(Action<,,,>), //4\n\t\t\t\t\t\t\t\ttypeof(Action<,,,,>), //5\n\t\t\t\t\t\t\t\ttypeof(Action<,,,,,>), //6\n\t\t\t\t\t\t\t\ttypeof(Action<,,,,,,>), //7\n\t\t\t\t\t\t\t\ttypeof(Action<,,,,,,,>), //8\n\t\t\t\t\t\t\t\ttypeof(Action<,,,,,,,,>), //9\n\t\t\t\t\t\t\t\ttypeof(Action<,,,,,,,,,>), //10\n\t\t\t\t\t\t\t\ttypeof(Action<,,,,,,,,,,>), //11\n\t\t\t\t\t\t\t\ttypeof(Action<,,,,,,,,,,,>), //12\n\t\t\t\t\t\t\t\ttypeof(Action<,,,,,,,,,,,,>), //13\n\t\t\t\t\t\t\t\ttypeof(Action<,,,,,,,,,,,,,>), //14\n\t\t\t\t\t\t\t\ttypeof(Action<,,,,,,,,,,,,,,>), //15\n\t\t\t\t\t\t\t\ttypeof(Action<,,,,,,,,,,,,,,,>), //16\n                            };\n\n\t\t\tTupleKinds = new []\n                            {\n\t\t\t\t\t\t\t\ttypeof(Tuple<>), //1\n\t\t\t\t\t\t\t\ttypeof(Tuple<,>), //2\n\t\t\t\t\t\t\t\ttypeof(Tuple<,,>), //3\n\t\t\t\t\t\t\t\ttypeof(Tuple<,,,>), //4\n\t\t\t\t\t\t\t\ttypeof(Tuple<,,,,>), //5\n\t\t\t\t\t\t\t\ttypeof(Tuple<,,,,,>), //6\n\t\t\t\t\t\t\t\ttypeof(Tuple<,,,,,,>), //7\n\t\t\t\t\t\t\t\ttypeof(Tuple<,,,,,,,>), //8\n                            };\n\n\n\t\t\tFuncArgs = FuncKinds.Zip(Enumerable.Range(0, FuncKinds.Length), (key, value) => new { key, value }).ToDictionary(k => k.key, v => v.value);\n            ActionArgs = ActionKinds.Zip(Enumerable.Range(0, ActionKinds.Length), (key, value) => new { key, value }).ToDictionary(k => k.key, v => v.value);\n\t\t\tTupleArgs = TupleKinds.Zip(Enumerable.Range(1, ActionKinds.Length), (key, value) => new { key, value }).ToDictionary(k => k.key, v => v.value);\n\n\t\t\n        }\n\n\t\tinternal static dynamic TupleItem(dynamic tuple, int index){\n\t\t\tswitch(index){\n\t\t\t\tcase 1:\n\t\t\t\t\treturn tuple.Item1;\n\t\t\t\tcase 2:\n\t\t\t\t\treturn tuple.Item2;\n\t\t\t\tcase 3:\n\t\t\t\t\treturn tuple.Item3;\n\t\t\t\tcase 4:\n\t\t\t\t\treturn tuple.Item4;\n\t\t\t\tcase 5:\n\t\t\t\t\treturn tuple.Item5;\n\t\t\t\tcase 6:\n\t\t\t\t\treturn tuple.Item6;\n\t\t\t\tcase 7:\n\t\t\t\t\treturn tuple.Item7;\n\t\t\t\tdefault:\n\t\t\t\t\treturn tuple.Rest;\n\t\t\t}\n\t\t}\n\n\n        internal static void InvokeMemberAction(ref CallSite callsite,\n\t\t                                            Type binderType,\n\t\t\t\t\t\t\t\t\t\t\t\t\tint knownType,\n\t\t\t\t\t\t\t\t\t\t\t\t\tLazyBinder binder,\n                                                    InvokeMemberName name,\n\t\t\t\t\t\t\t\t\t\t\t\t\tbool staticContext,\n                                                    Type context, \n                                                    string[] argNames,\n                                                    object target,\n                                                    params object [] args)\n        {\n\n            var tSwitch = args.Length;\n            switch (tSwitch)\n            {\n#region Optimizations\n                case 0:\n                    {\n\t\t\t\t\t\tvar tCallSite = (CallSite<Action<CallSite,  object>>)callsite;\n\t\t\t\t\t\tif(tCallSite == null){\n\t\t\t\t\t\t\ttCallSite = CreateCallSite<Action<CallSite,  object>>(binderType,knownType, binder, name, context, argNames, staticContext);\n\t\t\t\t\t\t    callsite=tCallSite;\n\t\t\t\t\t\t}\n                        tCallSite.Target(tCallSite, target);\n                        break;\n                    }\n                case 1:\n                    {\n\t\t\t\t\t\tvar tCallSite = (CallSite<Action<CallSite,  object, object>>)callsite;\n\t\t\t\t\t\tif(tCallSite == null){\n\t\t\t\t\t\t\ttCallSite = CreateCallSite<Action<CallSite,  object, object>>(binderType,knownType, binder, name, context, argNames, staticContext);\n\t\t\t\t\t\t    callsite=tCallSite;\n\t\t\t\t\t\t}\n                        tCallSite.Target(tCallSite, target, args[0]);\n                        break;\n                    }\n                case 2:\n                    {\n\t\t\t\t\t\tvar tCallSite = (CallSite<Action<CallSite,  object, object, object>>)callsite;\n\t\t\t\t\t\tif(tCallSite == null){\n\t\t\t\t\t\t\ttCallSite = CreateCallSite<Action<CallSite,  object, object, object>>(binderType,knownType, binder, name, context, argNames, staticContext);\n\t\t\t\t\t\t    callsite=tCallSite;\n\t\t\t\t\t\t}\n                        tCallSite.Target(tCallSite, target, args[0], args[1]);\n                        break;\n                    }\n                case 3:\n                    {\n\t\t\t\t\t\tvar tCallSite = (CallSite<Action<CallSite,  object, object, object, object>>)callsite;\n\t\t\t\t\t\tif(tCallSite == null){\n\t\t\t\t\t\t\ttCallSite = CreateCallSite<Action<CallSite,  object, object, object, object>>(binderType,knownType, binder, name, context, argNames, staticContext);\n\t\t\t\t\t\t    callsite=tCallSite;\n\t\t\t\t\t\t}\n                        tCallSite.Target(tCallSite, target, args[0], args[1], args[2]);\n                        break;\n                    }\n                case 4:\n                    {\n\t\t\t\t\t\tvar tCallSite = (CallSite<Action<CallSite,  object, object, object, object, object>>)callsite;\n\t\t\t\t\t\tif(tCallSite == null){\n\t\t\t\t\t\t\ttCallSite = CreateCallSite<Action<CallSite,  object, object, object, object, object>>(binderType,knownType, binder, name, context, argNames, staticContext);\n\t\t\t\t\t\t    callsite=tCallSite;\n\t\t\t\t\t\t}\n                        tCallSite.Target(tCallSite, target, args[0], args[1], args[2], args[3]);\n                        break;\n                    }\n                case 5:\n                    {\n\t\t\t\t\t\tvar tCallSite = (CallSite<Action<CallSite,  object, object, object, object, object, object>>)callsite;\n\t\t\t\t\t\tif(tCallSite == null){\n\t\t\t\t\t\t\ttCallSite = CreateCallSite<Action<CallSite,  object, object, object, object, object, object>>(binderType,knownType, binder, name, context, argNames, staticContext);\n\t\t\t\t\t\t    callsite=tCallSite;\n\t\t\t\t\t\t}\n                        tCallSite.Target(tCallSite, target, args[0], args[1], args[2], args[3], args[4]);\n                        break;\n                    }\n                case 6:\n                    {\n\t\t\t\t\t\tvar tCallSite = (CallSite<Action<CallSite,  object, object, object, object, object, object, object>>)callsite;\n\t\t\t\t\t\tif(tCallSite == null){\n\t\t\t\t\t\t\ttCallSite = CreateCallSite<Action<CallSite,  object, object, object, object, object, object, object>>(binderType,knownType, binder, name, context, argNames, staticContext);\n\t\t\t\t\t\t    callsite=tCallSite;\n\t\t\t\t\t\t}\n                        tCallSite.Target(tCallSite, target, args[0], args[1], args[2], args[3], args[4], args[5]);\n                        break;\n                    }\n                case 7:\n                    {\n\t\t\t\t\t\tvar tCallSite = (CallSite<Action<CallSite,  object, object, object, object, object, object, object, object>>)callsite;\n\t\t\t\t\t\tif(tCallSite == null){\n\t\t\t\t\t\t\ttCallSite = CreateCallSite<Action<CallSite,  object, object, object, object, object, object, object, object>>(binderType,knownType, binder, name, context, argNames, staticContext);\n\t\t\t\t\t\t    callsite=tCallSite;\n\t\t\t\t\t\t}\n                        tCallSite.Target(tCallSite, target, args[0], args[1], args[2], args[3], args[4], args[5], args[6]);\n                        break;\n                    }\n                case 8:\n                    {\n\t\t\t\t\t\tvar tCallSite = (CallSite<Action<CallSite,  object, object, object, object, object, object, object, object, object>>)callsite;\n\t\t\t\t\t\tif(tCallSite == null){\n\t\t\t\t\t\t\ttCallSite = CreateCallSite<Action<CallSite,  object, object, object, object, object, object, object, object, object>>(binderType,knownType, binder, name, context, argNames, staticContext);\n\t\t\t\t\t\t    callsite=tCallSite;\n\t\t\t\t\t\t}\n                        tCallSite.Target(tCallSite, target, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);\n                        break;\n                    }\n                case 9:\n                    {\n\t\t\t\t\t\tvar tCallSite = (CallSite<Action<CallSite,  object, object, object, object, object, object, object, object, object, object>>)callsite;\n\t\t\t\t\t\tif(tCallSite == null){\n\t\t\t\t\t\t\ttCallSite = CreateCallSite<Action<CallSite,  object, object, object, object, object, object, object, object, object, object>>(binderType,knownType, binder, name, context, argNames, staticContext);\n\t\t\t\t\t\t    callsite=tCallSite;\n\t\t\t\t\t\t}\n                        tCallSite.Target(tCallSite, target, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]);\n                        break;\n                    }\n                case 10:\n                    {\n\t\t\t\t\t\tvar tCallSite = (CallSite<Action<CallSite,  object, object, object, object, object, object, object, object, object, object, object>>)callsite;\n\t\t\t\t\t\tif(tCallSite == null){\n\t\t\t\t\t\t\ttCallSite = CreateCallSite<Action<CallSite,  object, object, object, object, object, object, object, object, object, object, object>>(binderType,knownType, binder, name, context, argNames, staticContext);\n\t\t\t\t\t\t    callsite=tCallSite;\n\t\t\t\t\t\t}\n                        tCallSite.Target(tCallSite, target, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]);\n                        break;\n                    }\n                case 11:\n                    {\n\t\t\t\t\t\tvar tCallSite = (CallSite<Action<CallSite,  object, object, object, object, object, object, object, object, object, object, object, object>>)callsite;\n\t\t\t\t\t\tif(tCallSite == null){\n\t\t\t\t\t\t\ttCallSite = CreateCallSite<Action<CallSite,  object, object, object, object, object, object, object, object, object, object, object, object>>(binderType,knownType, binder, name, context, argNames, staticContext);\n\t\t\t\t\t\t    callsite=tCallSite;\n\t\t\t\t\t\t}\n                        tCallSite.Target(tCallSite, target, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10]);\n                        break;\n                    }\n                case 12:\n                    {\n\t\t\t\t\t\tvar tCallSite = (CallSite<Action<CallSite,  object, object, object, object, object, object, object, object, object, object, object, object, object>>)callsite;\n\t\t\t\t\t\tif(tCallSite == null){\n\t\t\t\t\t\t\ttCallSite = CreateCallSite<Action<CallSite,  object, object, object, object, object, object, object, object, object, object, object, object, object>>(binderType,knownType, binder, name, context, argNames, staticContext);\n\t\t\t\t\t\t    callsite=tCallSite;\n\t\t\t\t\t\t}\n                        tCallSite.Target(tCallSite, target, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11]);\n                        break;\n                    }\n                case 13:\n                    {\n\t\t\t\t\t\tvar tCallSite = (CallSite<Action<CallSite,  object, object, object, object, object, object, object, object, object, object, object, object, object, object>>)callsite;\n\t\t\t\t\t\tif(tCallSite == null){\n\t\t\t\t\t\t\ttCallSite = CreateCallSite<Action<CallSite,  object, object, object, object, object, object, object, object, object, object, object, object, object, object>>(binderType,knownType, binder, name, context, argNames, staticContext);\n\t\t\t\t\t\t    callsite=tCallSite;\n\t\t\t\t\t\t}\n                        tCallSite.Target(tCallSite, target, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12]);\n                        break;\n                    }\n                case 14:\n                    {\n\t\t\t\t\t\tvar tCallSite = (CallSite<Action<CallSite,  object, object, object, object, object, object, object, object, object, object, object, object, object, object, object>>)callsite;\n\t\t\t\t\t\tif(tCallSite == null){\n\t\t\t\t\t\t\ttCallSite = CreateCallSite<Action<CallSite,  object, object, object, object, object, object, object, object, object, object, object, object, object, object, object>>(binderType,knownType, binder, name, context, argNames, staticContext);\n\t\t\t\t\t\t    callsite=tCallSite;\n\t\t\t\t\t\t}\n                        tCallSite.Target(tCallSite, target, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13]);\n                        break;\n                    }\n#endregion\n                default:\n                    var tArgTypes = Enumerable.Repeat(typeof(object), tSwitch);\n                    var tDelagateType = EmitCallSiteFuncType(tArgTypes, typeof(void));\n                    Dynamic.InvokeCallSite(CreateCallSite(tDelagateType, binderType,knownType, binder, name, context, argNames), target, args);\n                    break;\n\n            }\n        }\n\n        \n\n       \n\n\t\n\n\n\n\n        internal static TReturn InvokeMemberTargetType<TTarget,TReturn>(\n\t\t\t\t\t\t\t\t\t\tref CallSite callsite,\n\t\t\t\t\t\t\t\t\t\tType binderType,\n\t\t\t\t\t\t\t\t\t\tint knownType,\n\t\t\t\t\t\t\t\t\t\tLazyBinder binder,\n                                       InvokeMemberName name,\n\t\t\t\t\t\t\t\t\t bool staticContext,\n                                     Type context,\n                                     string[] argNames,\n                                     TTarget target, params object [] args)\n        {\n\n        \n\n            var tSwitch = args.Length;\n\n            switch (tSwitch)\n            {\n#region Optimizations\n                case 0:\n                    {\n\t\t\t\t\t    var tCallSite = (CallSite<Func<CallSite, TTarget, TReturn>>)callsite;\n\t\t\t\t\t    if(tCallSite==null){\n\t\t\t\t\t\t\t tCallSite = CreateCallSite<Func<CallSite, TTarget, TReturn>>(binderType,knownType,binder, name, context, argNames, staticContext);\n\t\t\t\t\t\t\t callsite =tCallSite;\n\t\t\t\t\t\t}\n                        return tCallSite.Target(tCallSite, target);\n                    }\n                case 1:\n                    {\n\t\t\t\t\t    var tCallSite = (CallSite<Func<CallSite, TTarget,  object,TReturn>>)callsite;\n\t\t\t\t\t    if(tCallSite==null){\n\t\t\t\t\t\t\t tCallSite = CreateCallSite<Func<CallSite, TTarget,  object,TReturn>>(binderType,knownType,binder, name, context, argNames, staticContext);\n\t\t\t\t\t\t\t callsite =tCallSite;\n\t\t\t\t\t\t}\n                        return tCallSite.Target(tCallSite, target, args[0]);\n                    }\n                case 2:\n                    {\n\t\t\t\t\t    var tCallSite = (CallSite<Func<CallSite, TTarget,  object, object,TReturn>>)callsite;\n\t\t\t\t\t    if(tCallSite==null){\n\t\t\t\t\t\t\t tCallSite = CreateCallSite<Func<CallSite, TTarget,  object, object,TReturn>>(binderType,knownType,binder, name, context, argNames, staticContext);\n\t\t\t\t\t\t\t callsite =tCallSite;\n\t\t\t\t\t\t}\n                        return tCallSite.Target(tCallSite, target, args[0], args[1]);\n                    }\n                case 3:\n                    {\n\t\t\t\t\t    var tCallSite = (CallSite<Func<CallSite, TTarget,  object, object, object,TReturn>>)callsite;\n\t\t\t\t\t    if(tCallSite==null){\n\t\t\t\t\t\t\t tCallSite = CreateCallSite<Func<CallSite, TTarget,  object, object, object,TReturn>>(binderType,knownType,binder, name, context, argNames, staticContext);\n\t\t\t\t\t\t\t callsite =tCallSite;\n\t\t\t\t\t\t}\n                        return tCallSite.Target(tCallSite, target, args[0], args[1], args[2]);\n                    }\n                case 4:\n                    {\n\t\t\t\t\t    var tCallSite = (CallSite<Func<CallSite, TTarget,  object, object, object, object,TReturn>>)callsite;\n\t\t\t\t\t    if(tCallSite==null){\n\t\t\t\t\t\t\t tCallSite = CreateCallSite<Func<CallSite, TTarget,  object, object, object, object,TReturn>>(binderType,knownType,binder, name, context, argNames, staticContext);\n\t\t\t\t\t\t\t callsite =tCallSite;\n\t\t\t\t\t\t}\n                        return tCallSite.Target(tCallSite, target, args[0], args[1], args[2], args[3]);\n                    }\n                case 5:\n                    {\n\t\t\t\t\t    var tCallSite = (CallSite<Func<CallSite, TTarget,  object, object, object, object, object,TReturn>>)callsite;\n\t\t\t\t\t    if(tCallSite==null){\n\t\t\t\t\t\t\t tCallSite = CreateCallSite<Func<CallSite, TTarget,  object, object, object, object, object,TReturn>>(binderType,knownType,binder, name, context, argNames, staticContext);\n\t\t\t\t\t\t\t callsite =tCallSite;\n\t\t\t\t\t\t}\n                        return tCallSite.Target(tCallSite, target, args[0], args[1], args[2], args[3], args[4]);\n                    }\n                case 6:\n                    {\n\t\t\t\t\t    var tCallSite = (CallSite<Func<CallSite, TTarget,  object, object, object, object, object, object,TReturn>>)callsite;\n\t\t\t\t\t    if(tCallSite==null){\n\t\t\t\t\t\t\t tCallSite = CreateCallSite<Func<CallSite, TTarget,  object, object, object, object, object, object,TReturn>>(binderType,knownType,binder, name, context, argNames, staticContext);\n\t\t\t\t\t\t\t callsite =tCallSite;\n\t\t\t\t\t\t}\n                        return tCallSite.Target(tCallSite, target, args[0], args[1], args[2], args[3], args[4], args[5]);\n                    }\n                case 7:\n                    {\n\t\t\t\t\t    var tCallSite = (CallSite<Func<CallSite, TTarget,  object, object, object, object, object, object, object,TReturn>>)callsite;\n\t\t\t\t\t    if(tCallSite==null){\n\t\t\t\t\t\t\t tCallSite = CreateCallSite<Func<CallSite, TTarget,  object, object, object, object, object, object, object,TReturn>>(binderType,knownType,binder, name, context, argNames, staticContext);\n\t\t\t\t\t\t\t callsite =tCallSite;\n\t\t\t\t\t\t}\n                        return tCallSite.Target(tCallSite, target, args[0], args[1], args[2], args[3], args[4], args[5], args[6]);\n                    }\n                case 8:\n                    {\n\t\t\t\t\t    var tCallSite = (CallSite<Func<CallSite, TTarget,  object, object, object, object, object, object, object, object,TReturn>>)callsite;\n\t\t\t\t\t    if(tCallSite==null){\n\t\t\t\t\t\t\t tCallSite = CreateCallSite<Func<CallSite, TTarget,  object, object, object, object, object, object, object, object,TReturn>>(binderType,knownType,binder, name, context, argNames, staticContext);\n\t\t\t\t\t\t\t callsite =tCallSite;\n\t\t\t\t\t\t}\n                        return tCallSite.Target(tCallSite, target, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);\n                    }\n                case 9:\n                    {\n\t\t\t\t\t    var tCallSite = (CallSite<Func<CallSite, TTarget,  object, object, object, object, object, object, object, object, object,TReturn>>)callsite;\n\t\t\t\t\t    if(tCallSite==null){\n\t\t\t\t\t\t\t tCallSite = CreateCallSite<Func<CallSite, TTarget,  object, object, object, object, object, object, object, object, object,TReturn>>(binderType,knownType,binder, name, context, argNames, staticContext);\n\t\t\t\t\t\t\t callsite =tCallSite;\n\t\t\t\t\t\t}\n                        return tCallSite.Target(tCallSite, target, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]);\n                    }\n                case 10:\n                    {\n\t\t\t\t\t    var tCallSite = (CallSite<Func<CallSite, TTarget,  object, object, object, object, object, object, object, object, object, object,TReturn>>)callsite;\n\t\t\t\t\t    if(tCallSite==null){\n\t\t\t\t\t\t\t tCallSite = CreateCallSite<Func<CallSite, TTarget,  object, object, object, object, object, object, object, object, object, object,TReturn>>(binderType,knownType,binder, name, context, argNames, staticContext);\n\t\t\t\t\t\t\t callsite =tCallSite;\n\t\t\t\t\t\t}\n                        return tCallSite.Target(tCallSite, target, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]);\n                    }\n                case 11:\n                    {\n\t\t\t\t\t    var tCallSite = (CallSite<Func<CallSite, TTarget,  object, object, object, object, object, object, object, object, object, object, object,TReturn>>)callsite;\n\t\t\t\t\t    if(tCallSite==null){\n\t\t\t\t\t\t\t tCallSite = CreateCallSite<Func<CallSite, TTarget,  object, object, object, object, object, object, object, object, object, object, object,TReturn>>(binderType,knownType,binder, name, context, argNames, staticContext);\n\t\t\t\t\t\t\t callsite =tCallSite;\n\t\t\t\t\t\t}\n                        return tCallSite.Target(tCallSite, target, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10]);\n                    }\n                case 12:\n                    {\n\t\t\t\t\t    var tCallSite = (CallSite<Func<CallSite, TTarget,  object, object, object, object, object, object, object, object, object, object, object, object,TReturn>>)callsite;\n\t\t\t\t\t    if(tCallSite==null){\n\t\t\t\t\t\t\t tCallSite = CreateCallSite<Func<CallSite, TTarget,  object, object, object, object, object, object, object, object, object, object, object, object,TReturn>>(binderType,knownType,binder, name, context, argNames, staticContext);\n\t\t\t\t\t\t\t callsite =tCallSite;\n\t\t\t\t\t\t}\n                        return tCallSite.Target(tCallSite, target, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11]);\n                    }\n                case 13:\n                    {\n\t\t\t\t\t    var tCallSite = (CallSite<Func<CallSite, TTarget,  object, object, object, object, object, object, object, object, object, object, object, object, object,TReturn>>)callsite;\n\t\t\t\t\t    if(tCallSite==null){\n\t\t\t\t\t\t\t tCallSite = CreateCallSite<Func<CallSite, TTarget,  object, object, object, object, object, object, object, object, object, object, object, object, object,TReturn>>(binderType,knownType,binder, name, context, argNames, staticContext);\n\t\t\t\t\t\t\t callsite =tCallSite;\n\t\t\t\t\t\t}\n                        return tCallSite.Target(tCallSite, target, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12]);\n                    }\n                case 14:\n                    {\n\t\t\t\t\t    var tCallSite = (CallSite<Func<CallSite, TTarget,  object, object, object, object, object, object, object, object, object, object, object, object, object, object,TReturn>>)callsite;\n\t\t\t\t\t    if(tCallSite==null){\n\t\t\t\t\t\t\t tCallSite = CreateCallSite<Func<CallSite, TTarget,  object, object, object, object, object, object, object, object, object, object, object, object, object, object,TReturn>>(binderType,knownType,binder, name, context, argNames, staticContext);\n\t\t\t\t\t\t\t callsite =tCallSite;\n\t\t\t\t\t\t}\n                        return tCallSite.Target(tCallSite, target, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13]);\n                    }\n#endregion\n                default:\n                    var tArgTypes = Enumerable.Repeat(typeof(object), tSwitch);\n                    var tDelagateType = EmitCallSiteFuncType(tArgTypes, typeof(TTarget));\n                    return Dynamic.InvokeCallSite(CreateCallSite(tDelagateType, binderType,knownType, binder, name, context, argNames), target, args);\n\n            }\n        }\n\n     \n\n\n\n\n\t\tinternal static Delegate WrapFuncHelper<TReturn>(dynamic invokable, int length)\n        {\n\t\t\t switch(length){\n#region Optimizations\n\t\t\t   \t\t\t\t\tcase 0:\n\t\t\t\t\t\treturn new Func< TReturn>(()=> invokable());\n  \t\t\t\t\tcase 1:\n\t\t\t\t\t\treturn new Func< object, TReturn>((a1)=> invokable(a1));\n  \t\t\t\t\tcase 2:\n\t\t\t\t\t\treturn new Func< object, object, TReturn>((a1,a2)=> invokable(a1,a2));\n  \t\t\t\t\tcase 3:\n\t\t\t\t\t\treturn new Func< object, object, object, TReturn>((a1,a2,a3)=> invokable(a1,a2,a3));\n  \t\t\t\t\tcase 4:\n\t\t\t\t\t\treturn new Func< object, object, object, object, TReturn>((a1,a2,a3,a4)=> invokable(a1,a2,a3,a4));\n  \t\t\t\t\tcase 5:\n\t\t\t\t\t\treturn new Func< object, object, object, object, object, TReturn>((a1,a2,a3,a4,a5)=> invokable(a1,a2,a3,a4,a5));\n  \t\t\t\t\tcase 6:\n\t\t\t\t\t\treturn new Func< object, object, object, object, object, object, TReturn>((a1,a2,a3,a4,a5,a6)=> invokable(a1,a2,a3,a4,a5,a6));\n  \t\t\t\t\tcase 7:\n\t\t\t\t\t\treturn new Func< object, object, object, object, object, object, object, TReturn>((a1,a2,a3,a4,a5,a6,a7)=> invokable(a1,a2,a3,a4,a5,a6,a7));\n  \t\t\t\t\tcase 8:\n\t\t\t\t\t\treturn new Func< object, object, object, object, object, object, object, object, TReturn>((a1,a2,a3,a4,a5,a6,a7,a8)=> invokable(a1,a2,a3,a4,a5,a6,a7,a8));\n  \t\t\t\t\tcase 9:\n\t\t\t\t\t\treturn new Func< object, object, object, object, object, object, object, object, object, TReturn>((a1,a2,a3,a4,a5,a6,a7,a8,a9)=> invokable(a1,a2,a3,a4,a5,a6,a7,a8,a9));\n  \t\t\t\t\tcase 10:\n\t\t\t\t\t\treturn new Func< object, object, object, object, object, object, object, object, object, object, TReturn>((a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)=> invokable(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10));\n  \t\t\t\t\tcase 11:\n\t\t\t\t\t\treturn new Func< object, object, object, object, object, object, object, object, object, object, object, TReturn>((a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)=> invokable(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11));\n  \t\t\t\t\tcase 12:\n\t\t\t\t\t\treturn new Func< object, object, object, object, object, object, object, object, object, object, object, object, TReturn>((a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)=> invokable(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12));\n  \t\t\t\t\tcase 13:\n\t\t\t\t\t\treturn new Func< object, object, object, object, object, object, object, object, object, object, object, object, object, TReturn>((a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13)=> invokable(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13));\n  \t\t\t\t\tcase 14:\n\t\t\t\t\t\treturn new Func< object, object, object, object, object, object, object, object, object, object, object, object, object, object, TReturn>((a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14)=> invokable(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14));\n  \t\t\t\t\tcase 15:\n\t\t\t\t\t\treturn new Func< object, object, object, object, object, object, object, object, object, object, object, object, object, object, object, TReturn>((a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15)=> invokable(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15));\n  \t\t\t\t\tcase 16:\n\t\t\t\t\t\treturn new Func< object, object, object, object, object, object, object, object, object, object, object, object, object, object, object, object, TReturn>((a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16)=> invokable(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16));\n#endregion\t\n\t\t\t\tdefault:\n\t\t\t\t\treturn new DynamicFunc<TReturn>(args=>(TReturn)Dynamic.Invoke((object)invokable,args));\n\t\t\t}\n        }\n\n\n        internal static Delegate WrapAction(dynamic invokable, int length)\n        {\n           \t switch(length){\n#region Optimizations\n\t\t\t\t    case 0:\n\t\t\t\t\t    return new Action(()=>invokable());\n  \t\t\t\t\tcase 1:\n\t\t\t\t\t\treturn new Action< object>((a1)=> invokable(a1));\n  \t\t\t\t\tcase 2:\n\t\t\t\t\t\treturn new Action< object, object>((a1,a2)=> invokable(a1,a2));\n  \t\t\t\t\tcase 3:\n\t\t\t\t\t\treturn new Action< object, object, object>((a1,a2,a3)=> invokable(a1,a2,a3));\n  \t\t\t\t\tcase 4:\n\t\t\t\t\t\treturn new Action< object, object, object, object>((a1,a2,a3,a4)=> invokable(a1,a2,a3,a4));\n  \t\t\t\t\tcase 5:\n\t\t\t\t\t\treturn new Action< object, object, object, object, object>((a1,a2,a3,a4,a5)=> invokable(a1,a2,a3,a4,a5));\n  \t\t\t\t\tcase 6:\n\t\t\t\t\t\treturn new Action< object, object, object, object, object, object>((a1,a2,a3,a4,a5,a6)=> invokable(a1,a2,a3,a4,a5,a6));\n  \t\t\t\t\tcase 7:\n\t\t\t\t\t\treturn new Action< object, object, object, object, object, object, object>((a1,a2,a3,a4,a5,a6,a7)=> invokable(a1,a2,a3,a4,a5,a6,a7));\n  \t\t\t\t\tcase 8:\n\t\t\t\t\t\treturn new Action< object, object, object, object, object, object, object, object>((a1,a2,a3,a4,a5,a6,a7,a8)=> invokable(a1,a2,a3,a4,a5,a6,a7,a8));\n  \t\t\t\t\tcase 9:\n\t\t\t\t\t\treturn new Action< object, object, object, object, object, object, object, object, object>((a1,a2,a3,a4,a5,a6,a7,a8,a9)=> invokable(a1,a2,a3,a4,a5,a6,a7,a8,a9));\n  \t\t\t\t\tcase 10:\n\t\t\t\t\t\treturn new Action< object, object, object, object, object, object, object, object, object, object>((a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)=> invokable(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10));\n  \t\t\t\t\tcase 11:\n\t\t\t\t\t\treturn new Action< object, object, object, object, object, object, object, object, object, object, object>((a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)=> invokable(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11));\n  \t\t\t\t\tcase 12:\n\t\t\t\t\t\treturn new Action< object, object, object, object, object, object, object, object, object, object, object, object>((a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)=> invokable(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12));\n  \t\t\t\t\tcase 13:\n\t\t\t\t\t\treturn new Action< object, object, object, object, object, object, object, object, object, object, object, object, object>((a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13)=> invokable(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13));\n  \t\t\t\t\tcase 14:\n\t\t\t\t\t\treturn new Action< object, object, object, object, object, object, object, object, object, object, object, object, object, object>((a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14)=> invokable(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14));\n  \t\t\t\t\tcase 15:\n\t\t\t\t\t\treturn new Action< object, object, object, object, object, object, object, object, object, object, object, object, object, object, object>((a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15)=> invokable(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15));\n  \t\t\t\t\tcase 16:\n\t\t\t\t\t\treturn new Action< object, object, object, object, object, object, object, object, object, object, object, object, object, object, object, object>((a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16)=> invokable(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16));\n#endregion\t\t\n\t\t\t\tdefault:\n\t\t\t\t\treturn new DynamicAction(args=>Dynamic.InvokeAction((object)invokable,args));\n\t\t\t}\n        }\n\n\n        internal static object FastDynamicInvokeReturn(Delegate del, dynamic [] args)\n        {\n            dynamic tDel =del;\n            switch(args.Length){\n                default:\n                    try\n                    {\n                        return del.DynamicInvoke(args);\n                    }\n                    catch (TargetInvocationException ex)\n                    {\n                        throw ex.InnerException;\n                    }\n#region Optimization\n\t\t\t\tcase 1:\n                    return tDel(args[0]);\n\t\t\t\tcase 2:\n                    return tDel(args[0],args[1]);\n\t\t\t\tcase 3:\n                    return tDel(args[0],args[1],args[2]);\n\t\t\t\tcase 4:\n                    return tDel(args[0],args[1],args[2],args[3]);\n\t\t\t\tcase 5:\n                    return tDel(args[0],args[1],args[2],args[3],args[4]);\n\t\t\t\tcase 6:\n                    return tDel(args[0],args[1],args[2],args[3],args[4],args[5]);\n\t\t\t\tcase 7:\n                    return tDel(args[0],args[1],args[2],args[3],args[4],args[5],args[6]);\n\t\t\t\tcase 8:\n                    return tDel(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7]);\n\t\t\t\tcase 9:\n                    return tDel(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8]);\n\t\t\t\tcase 10:\n                    return tDel(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9]);\n\t\t\t\tcase 11:\n                    return tDel(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10]);\n\t\t\t\tcase 12:\n                    return tDel(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10],args[11]);\n\t\t\t\tcase 13:\n                    return tDel(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10],args[11],args[12]);\n\t\t\t\tcase 14:\n                    return tDel(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10],args[11],args[12],args[13]);\n\t\t\t\tcase 15:\n                    return tDel(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10],args[11],args[12],args[13],args[14]);\n\t\t\t\tcase 16:\n                    return tDel(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10],args[11],args[12],args[13],args[14],args[15]);\n#endregion\n            }\n        }\n\n        internal static void FastDynamicInvokeAction(Delegate del, params dynamic [] args)\n        {\n            dynamic tDel =del;\n            switch(args.Length){\n                default: \n\t\t\t\t\ttry\n                    {\n\t\t\t\t\t\tdel.DynamicInvoke(args);\n\t\t\t\t\t}\n\t\t\t\t\tcatch (TargetInvocationException ex)\n                    {\n                        throw ex.InnerException;\n                    }\n                    return;\n#region Optimization\n\t\t\t\tcase 1:\n                    tDel(args[0]);\n                    return;\n\t\t\t\tcase 2:\n                    tDel(args[0],args[1]);\n                    return;\n\t\t\t\tcase 3:\n                    tDel(args[0],args[1],args[2]);\n                    return;\n\t\t\t\tcase 4:\n                    tDel(args[0],args[1],args[2],args[3]);\n                    return;\n\t\t\t\tcase 5:\n                    tDel(args[0],args[1],args[2],args[3],args[4]);\n                    return;\n\t\t\t\tcase 6:\n                    tDel(args[0],args[1],args[2],args[3],args[4],args[5]);\n                    return;\n\t\t\t\tcase 7:\n                    tDel(args[0],args[1],args[2],args[3],args[4],args[5],args[6]);\n                    return;\n\t\t\t\tcase 8:\n                    tDel(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7]);\n                    return;\n\t\t\t\tcase 9:\n                    tDel(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8]);\n                    return;\n\t\t\t\tcase 10:\n                    tDel(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9]);\n                    return;\n\t\t\t\tcase 11:\n                    tDel(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10]);\n                    return;\n\t\t\t\tcase 12:\n                    tDel(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10],args[11]);\n                    return;\n\t\t\t\tcase 13:\n                    tDel(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10],args[11],args[12]);\n                    return;\n\t\t\t\tcase 14:\n                    tDel(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10],args[11],args[12],args[13]);\n                    return;\n\t\t\t\tcase 15:\n                    tDel(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10],args[11],args[12],args[13],args[14]);\n                    return;\n\t\t\t\tcase 16:\n                    tDel(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10],args[11],args[12],args[13],args[14],args[15]);\n                    return;\n#endregion\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "Dynamitey/Internal/Optimization/InvokeHelper.tt",
    "content": "﻿<#@ template language=\"C#\" #>\n<#@ output extension=\"cs\" #>\n<#@ assembly  name=\"System.Core\" #>\n<#@ import namespace=\"System.Linq\" #>\n\n// \n//  Copyright 2011 Ekon Benefits\n// \n//    Licensed under the Apache License, Version 2.0 (the \"License\");\n//    you may not use this file except in compliance with the License.\n//    You may obtain a copy of the License at\n// \n//        http://www.apache.org/licenses/LICENSE-2.0\n// \n//    Unless required by applicable law or agreed to in writing, software\n//    distributed under the License is distributed on an \"AS IS\" BASIS,\n//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//    See the License for the specific language governing permissions and\n//    limitations under the License.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Reflection;\n\nnamespace Dynamitey.Internal.Optimization {\n\n<# var cacheTypes = new []{\"\", \"Get\", \"Set\", \"Constructor\", \"Member\", \"Direct\"}; #>\n\n<# foreach(var name in cacheTypes){ #>\n    internal static class Binder<#=name#>Cache<T> where T : class\n    {\n        private static IDictionary<BinderHash<T>, CallSite<T>> _cache;\n\n        private static readonly object _cacheLock = new object();\n\n        internal static IDictionary<BinderHash<T>, CallSite<T>> Cache\n        {\n            get\n            {\n                lock (_cacheLock)\n                {\n                    return _cache ?? (_cache = new Dictionary<BinderHash<T>, CallSite<T>>());\n                }\n            }\n        }\n\n        internal static readonly Action ClearCache = () =>\n        {\n            lock (_cacheLock)\n            {\n                _cache = null;\n            }\n        };\n    }\n<# } #>\n\n    internal static partial class InvokeHelper\n    {\n\n\n        internal static readonly Type[] FuncKinds;\n        internal static readonly Type[] ActionKinds;\n\t\tinternal static readonly Type[] TupleKinds;\n\n\t\tinternal static readonly IDictionary<Type,int> FuncArgs;\n\t\tinternal static readonly IDictionary<Type,int> ActionArgs;\n\t\tinternal static readonly IDictionary<Type,int> TupleArgs;\n\n        static InvokeHelper()\n        {\n            FuncKinds = new []\n                            {\n<# for(int i=0; i <= 16; i++){ \n\tvar tCommas = String.Concat(Enumerable.Repeat(\",\",i));\n#>\n\t\t\t\t\t\t\t\ttypeof(Func<<#=tCommas#>>), //<#=i#>\n<# } #>\n                            };\n\n            ActionKinds = new []\n                            {\n                                typeof(Action), //0\n<# for(int i=1; i <= 16; i++){ \n\tvar tCommas = String.Concat(Enumerable.Repeat(\",\",i-1));\n#>\n\t\t\t\t\t\t\t\ttypeof(Action<<#=tCommas#>>), //<#=i#>\n<# } #>\n                            };\n\n\t\t\tTupleKinds = new []\n                            {\n<# for(int i=1; i <= 8; i++){ \n\tvar tCommas = String.Concat(Enumerable.Repeat(\",\",i-1));\n#>\n\t\t\t\t\t\t\t\ttypeof(Tuple<<#=tCommas#>>), //<#=i#>\n<# } #>\n                            };\n\n\n\t\t\tFuncArgs = FuncKinds.Zip(Enumerable.Range(0, FuncKinds.Length), (key, value) => new { key, value }).ToDictionary(k => k.key, v => v.value);\n            ActionArgs = ActionKinds.Zip(Enumerable.Range(0, ActionKinds.Length), (key, value) => new { key, value }).ToDictionary(k => k.key, v => v.value);\n\t\t\tTupleArgs = TupleKinds.Zip(Enumerable.Range(1, ActionKinds.Length), (key, value) => new { key, value }).ToDictionary(k => k.key, v => v.value);\n\n\t\t\n        }\n\n\t\tinternal static dynamic TupleItem(dynamic tuple, int index){\n\t\t\tswitch(index){\n<# for(int i=1; i <= 7; i++){ #>\n\t\t\t\tcase <#=i#>:\n\t\t\t\t\treturn tuple.Item<#=i#>;\n<# } #>\n\t\t\t\tdefault:\n\t\t\t\t\treturn tuple.Rest;\n\t\t\t}\n\t\t}\n\n\n        internal static void InvokeMemberAction(ref CallSite callsite,\n\t\t                                            Type binderType,\n\t\t\t\t\t\t\t\t\t\t\t\t\tint knownType,\n\t\t\t\t\t\t\t\t\t\t\t\t\tLazyBinder binder,\n                                                    InvokeMemberName name,\n\t\t\t\t\t\t\t\t\t\t\t\t\tbool staticContext,\n                                                    Type context, \n                                                    string[] argNames,\n                                                    object target,\n                                                    params object [] args)\n        {\n\n            var tSwitch = args.Length;\n            switch (tSwitch)\n            {\n#region Optimizations\n<# for(int i=0; i <= 14; i++){ \n\t\tvar tobjectArgs = String.Join(\",\",Enumerable.Repeat(\" object\",i+1));\n\t\tvar tArrayArgs = String.Concat(Enumerable.Range(0,i).Select(it=>String.Format(\", args[{0}]\",it)));\n#>\n                case <#=i#>:\n                    {\n\t\t\t\t\t\tvar tCallSite = (CallSite<Action<CallSite, <#=tobjectArgs#>>>)callsite;\n\t\t\t\t\t\tif(tCallSite == null){\n\t\t\t\t\t\t\ttCallSite = CreateCallSite<Action<CallSite, <#=tobjectArgs#>>>(binderType,knownType, binder, name, context, argNames, staticContext);\n\t\t\t\t\t\t    callsite=tCallSite;\n\t\t\t\t\t\t}\n                        tCallSite.Target(tCallSite, target<#=tArrayArgs#>);\n                        break;\n                    }\n<# } #>\n#endregion\n                default:\n                    var tArgTypes = Enumerable.Repeat(typeof(object), tSwitch);\n                    var tDelagateType = EmitCallSiteFuncType(tArgTypes, typeof(void));\n                    Dynamic.InvokeCallSite(CreateCallSite(tDelagateType, binderType,knownType, binder, name, context, argNames), target, args);\n                    break;\n\n            }\n        }\n\n        \n\n       \n\n\t\n\n\n\n\n        internal static TReturn InvokeMemberTargetType<TTarget,TReturn>(\n\t\t\t\t\t\t\t\t\t\tref CallSite callsite,\n\t\t\t\t\t\t\t\t\t\tType binderType,\n\t\t\t\t\t\t\t\t\t\tint knownType,\n\t\t\t\t\t\t\t\t\t\tLazyBinder binder,\n                                       InvokeMemberName name,\n\t\t\t\t\t\t\t\t\t bool staticContext,\n                                     Type context,\n                                     string[] argNames,\n                                     TTarget target, params object [] args)\n        {\n\n        \n\n            var tSwitch = args.Length;\n\n            switch (tSwitch)\n            {\n#region Optimizations\n<# for(int i=0; i <= 14; i++){ \n\t\tvar tobjectArgs = String.Join(\",\",Enumerable.Repeat(\" object\",i).Concat(new[]{\"TReturn\"}));\n\t\tvar tArrayArgs = String.Concat(Enumerable.Range(0,i).Select(it=>String.Format(\", args[{0}]\",it)));\n#>\n                case <#=i#>:\n                    {\n\t\t\t\t\t    var tCallSite = (CallSite<Func<CallSite, TTarget, <#=tobjectArgs#>>>)callsite;\n\t\t\t\t\t    if(tCallSite==null){\n\t\t\t\t\t\t\t tCallSite = CreateCallSite<Func<CallSite, TTarget, <#=tobjectArgs#>>>(binderType,knownType,binder, name, context, argNames, staticContext);\n\t\t\t\t\t\t\t callsite =tCallSite;\n\t\t\t\t\t\t}\n                        return tCallSite.Target(tCallSite, target<#=tArrayArgs#>);\n                    }\n<# } #>\n#endregion\n                default:\n                    var tArgTypes = Enumerable.Repeat(typeof(object), tSwitch);\n                    var tDelagateType = EmitCallSiteFuncType(tArgTypes, typeof(TTarget));\n                    return Dynamic.InvokeCallSite(CreateCallSite(tDelagateType, binderType,knownType, binder, name, context, argNames), target, args);\n\n            }\n        }\n\n     \n\n\n\n\n\t\tinternal static Delegate WrapFuncHelper<TReturn>(dynamic invokable, int length)\n        {\n\t\t\t switch(length){\n#region Optimizations\n\t\t\t <# for(int i=0; i <= 16; i++){ \n\t\t\t\tvar tobjectArgs = String.Join(\",\",Enumerable.Repeat(\" object\",i).Concat(new[]{\" TReturn\"}));\n  \t\t\t\tvar tArgList = String.Join(\",\",Enumerable.Range(0,i).Select(it=>\"a\"+(it+1)));\n#>  \t\t\t\t\tcase <#=i#>:\n\t\t\t\t\t\treturn new Func<<#=tobjectArgs#>>((<#=tArgList#>)=> invokable(<#=tArgList#>));\n<# } #>\n#endregion\t\n\t\t\t\tdefault:\n\t\t\t\t\treturn new DynamicFunc<TReturn>(args=>(TReturn)Dynamic.Invoke((object)invokable,args));\n\t\t\t}\n        }\n\n        internal static Delegate WrapAction(dynamic invokable, int length)\n        {\n           \t switch(length){\n#region Optimizations\n\t\t\t\t    case 0:\n\t\t\t\t\t    return new Action(()=>invokable());\n<# for(int i=1; i <= 16; i++){ \n\t\t\t\tvar tobjectArgs = String.Join(\",\",Enumerable.Repeat(\" object\",i));\n\t\t\t\tvar tArgList = String.Join(\",\",Enumerable.Range(0,i).Select(it=>\"a\"+(it+1)));\n#>  \t\t\t\t\tcase <#=i#>:\n\t\t\t\t\t\treturn new Action<<#=tobjectArgs#>>((<#=tArgList#>)=> invokable(<#=tArgList#>));\n<# } #>\n#endregion\t\t\n\t\t\t\tdefault:\n\t\t\t\t\treturn new DynamicAction(args=>Dynamic.InvokeAction((object)invokable,args));\n\t\t\t}\n        }\n\n\n        internal static object FastDynamicInvokeReturn(Delegate del, dynamic [] args)\n        {\n            dynamic tDel =del;\n            switch(args.Length){\n                default:\n                    try\n                    {\n                        return del.DynamicInvoke(args);\n                    }\n                    catch (TargetInvocationException ex)\n                    {\n                        throw ex.InnerException;\n                    }\n#region Optimization\n<# for(int i=1; i <= 16; i++){ \n\tvar tArgs = String.Join(\",\",Enumerable.Range(0,i).Select(it=>String.Format(\"args[{0}]\",it)));\n#>\t\t\t\tcase <#=i#>:\n                    return tDel(<#= tArgs #>);\n<# } #>\n#endregion\n            }\n        }\n\n        internal static void FastDynamicInvokeAction(Delegate del, params dynamic [] args)\n        {\n            dynamic tDel =del;\n            switch(args.Length){\n                default: \n\t\t\t\t\ttry\n                    {\n\t\t\t\t\t\tdel.DynamicInvoke(args);\n\t\t\t\t\t}\n\t\t\t\t\tcatch (TargetInvocationException ex)\n                    {\n                        throw ex.InnerException;\n                    }\n                    return;\n#region Optimization\n<# for(int i=1; i <= 16; i++){ \n\tvar tArgs = String.Join(\",\",Enumerable.Range(0,i).Select(it=>String.Format(\"args[{0}]\",it)));\n#>\t\t\t\tcase <#=i#>:\n                    tDel(<#= tArgs #>);\n                    return;\n<# } #>\n#endregion\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "Dynamitey/Internal/Optimization/Util.cs",
    "content": "﻿// \n//  Copyright 2011  Ekon Benefits\n// \n//    Licensed under the Apache License, Version 2.0 (the \"License\");\n//    you may not use this file except in compliance with the License.\n//    You may obtain a copy of the License at\n// \n//        http://www.apache.org/licenses/LICENSE-2.0\n// \n//    Unless required by applicable law or agreed to in writing, software\n//    distributed under the License is distributed on an \"AS IS\" BASIS,\n//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//    See the License for the specific language governing permissions and\n//    limitations under the License.\n\n\nusing System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Dynamic;\nusing System.Linq;\nusing System.Reflection;\nusing System.Runtime.CompilerServices;\nusing Dynamitey.DynamicObjects;\nusing Microsoft.CSharp.RuntimeBinder;\nusing Dynamitey.Internal.Compat;\n\n\nnamespace Dynamitey.Internal.Optimization\n{\n    /// <summary>\n    /// Utility Class\n    /// </summary>\n    public static class Util\n    {\n        /// <summary>\n        /// Is Current Runtime Mono?\n        /// </summary>\n        public static readonly bool IsMono;\n\n        static Util()\n        {\n            IsMono = Type.GetType(\"Mono.Runtime\") != null;\n\n\n        }\n   \n\n\n        /// <summary>\n        /// Determines whether [is anonymous type] [the specified target].\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <returns>\n        /// \t<c>true</c> if [is anonymous type] [the specified target]; otherwise, <c>false</c>.\n        /// </returns>\n        public static bool IsAnonymousType(object target)\n        {\n            if (target == null)\n                return false;\n\n            var type = target as Type ?? target.GetType();\n            var typeinfo = type.GetTypeInfo();\n            return typeinfo.IsNotPublic\n                   && typeinfo.IsDefined(\n                       typeof(CompilerGeneratedAttribute),\n                       false);\n        }\n\n\n        /// <summary>\n        /// Names the args if necessary.\n        /// </summary>\n        /// <param name=\"callInfo\">The call info.</param>\n        /// <param name=\"args\">The args.</param>\n        /// <returns></returns>\n        public static object[] NameArgsIfNecessary(CallInfo callInfo, object[] args)\n        {\n            object[] tArgs;\n            if (callInfo.ArgumentNames.Count == 0)\n                tArgs = args;\n            else\n            {\n                var tStop = callInfo.ArgumentCount - callInfo.ArgumentNames.Count;\n                tArgs = Enumerable.Repeat(default(string), tStop).Concat(callInfo.ArgumentNames).Zip(args, (n, v) => n == null ? v : new InvokeArg(n, v)).ToArray();\n            }\n            return tArgs;\n        }\n\n        /// <summary>\n        /// Gets the target context.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <param name=\"context\">The context.</param>\n        /// <param name=\"staticContext\">if set to <c>true</c> [static context].</param>\n        /// <returns></returns>\n        public static object GetTargetContext(this object target, out Type context, out bool staticContext)\n        {\n            var tInvokeContext = target as InvokeContext;\n            staticContext = false;\n            if (tInvokeContext != null)\n            {\n                staticContext = tInvokeContext.StaticContext;\n                context = tInvokeContext.Context;\n                context = context.FixContext();\n                return tInvokeContext.Target;\n            }\n\n            context = target as Type ?? target.GetType();\n            context = context.FixContext();\n            return target;\n        }\n\n\n        /// <summary>\n        /// Fixes the context.\n        /// </summary>\n        /// <param name=\"context\">The context.</param>\n        /// <returns></returns>\n        public static Type FixContext(this Type context)\n        {\n            if (context.IsArray)\n            {\n                return typeof (object);\n            }\n            return context;\n        }\n\n   \n        internal static bool MassageResultBasedOnInterface(this BaseObject target, string binderName, bool resultFound, ref object result)\n        {\n            if (result is BaseForwarder.AddRemoveMarker) //Don't massage AddRemove Proxies\n                return true;\n\n            var tTryType = target.TryTypeForName(binderName, out var tType);\n            if (tTryType && tType == typeof(void))\n            {\n                return true;\n            }\n\n            if(resultFound){\n              if (result is IDictionary<string, object> && !(result is BaseDictionary)\n                    && (!tTryType || tType == typeof(object)))\n                {\n                    result = new Dictionary((IDictionary<string, object>)result);\n                }\n              else if (tTryType)\n              {\n                  result = Dynamic.CoerceConvert(result, tType);\n              }\n            }\n            else\n            {\n                result = null;\n                if (!tTryType)\n                {\n\n                    return false;\n                }\n                if (typeof (Delegate).GetTypeInfo().IsAssignableFrom(tType))\n                {\n                    result = new BaseForwarder.AddRemoveMarker();\n                }\n\n                if (tType.GetTypeInfo().IsValueType)\n                {\n                    result = Dynamic.InvokeConstructor(tType);\n                }\n            }\n            return true;\n        }\n\n\n\n\n        internal static object[] GetArgsAndNames(object[]args,out string[]argNames)\n        {\n            if (args == null)\n                args = new object[] { null };\n\n            //Optimization: linq statement creates a slight overhead in this case\n            // ReSharper disable LoopCanBeConvertedToQuery\n            // ReSharper disable ForCanBeConvertedToForeach\n            argNames = new string[args.Length];\n\n            var tArgSet = false;\n            var tNewArgs = new object[args.Length];\n            for (int i = 0; i < args.Length; i++)\n            {\n                var tArg = args[i];\n                string tName = null;\n\n                if (tArg is InvokeArg)\n                {\n                    tName = ((InvokeArg)tArg).Name;\n\n                    tNewArgs[i] = ((InvokeArg)tArg).Value;\n                    tArgSet = true;\n                }else\n                {\n                    tNewArgs[i] = tArg;\n                }\n                argNames[i] = tName;\n            }\n\n            // ReSharper restore ForCanBeConvertedToForeach\n            // ReSharper restore LoopCanBeConvertedToQuery\n            if (!tArgSet)\n                argNames = null;\n            return tNewArgs;\n        }\n    }\n}\n"
  },
  {
    "path": "Dynamitey/Invocation.cs",
    "content": "﻿// \n//  Copyright 2011  Ekon Benefits\n// \n//    Licensed under the Apache License, Version 2.0 (the \"License\");\n//    you may not use this file except in compliance with the License.\n//    You may obtain a copy of the License at\n// \n//        http://www.apache.org/licenses/LICENSE-2.0\n// \n//    Unless required by applicable law or agreed to in writing, software\n//    distributed under the License is distributed on an \"AS IS\" BASIS,\n//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//    See the License for the specific language governing permissions and\n//    limitations under the License.\n\n\nusing System;\nusing System.Linq;\nusing Microsoft.CSharp.RuntimeBinder;\n\nnamespace Dynamitey\n{\n    /// <summary>\n    /// Type of Invocation\n    /// </summary>\n\n    public enum InvocationKind\n    {\n        /// <summary>\n        /// NotSet\n        /// </summary>\n        NotSet=0,\n        /// <summary>\n        /// Convert Implicit or Explicity\n        /// </summary>\n        Convert,\n        /// <summary>\n        /// Get Property\n        /// </summary>\n        Get,\n        /// <summary>\n        /// Set Property\n        /// </summary>\n        Set,\n        /// <summary>\n        /// Get Indexer\n        /// </summary>\n        GetIndex,\n        /// <summary>\n        /// Set Indexer\n        /// </summary>\n        SetIndex,\n        /// <summary>\n        /// Invoke Method the has return value\n        /// </summary>\n        InvokeMember,\n        /// <summary>\n        /// Invoke Method that returns void\n        /// </summary>\n        InvokeMemberAction,\n        /// <summary>\n        /// Invoke Method that could return a value or void\n        /// </summary>\n        InvokeMemberUnknown,\n        /// <summary>\n        /// Invoke Constructor\n        /// </summary>\n        Constructor,\n        /// <summary>\n        /// Invoke +=\n        /// </summary>\n        AddAssign,\n        /// <summary>\n        /// Invoke -=\n        /// </summary>\n        SubtractAssign,\n        /// <summary>\n        /// Invoke Event Property Test\n        /// </summary>\n        IsEvent,\n        /// <summary>\n        /// Invoke Directly\n        /// </summary>\n        Invoke,\n        /// <summary>\n        /// Invoke Directly DiscardResult\n        /// </summary>\n        InvokeAction,\n        /// <summary>\n        /// Invoke Directly Return Value\n        /// </summary>\n        InvokeUnknown,\n\n    }\n\n\n    /// <summary>\n    /// Storable representation of an invocation without the target\n    /// </summary>\n    public class Invocation\n    {\n\n        /// <summary>\n        /// Defacto Binder Name for Explicit Convert Op\n        /// </summary>\n        public static readonly string ExplicitConvertBinderName = \"(Explicit)\";\n\n        /// <summary>\n        /// Defacto Binder Name for Implicit Convert Op\n        /// </summary>\n        public static readonly string ImplicitConvertBinderName = \"(Implicit)\";\n\n        /// <summary>\n        /// Defacto Binder Name for Indexer\n        /// </summary>\n        public static readonly string IndexBinderName = \"Item\";\n\n\n        /// <summary>\n        /// Defacto Binder Name for Constructor\n        /// </summary>\n        public static readonly string ConstructorBinderName = \"new()\";\n\n        /// <summary>\n        /// Gets or sets the kind.\n        /// </summary>\n        /// <value>The kind.</value>\n        public InvocationKind Kind { get; protected set; }\n        /// <summary>\n        /// Gets or sets the name.\n        /// </summary>\n        /// <value>The name.</value>\n        public String_OR_InvokeMemberName Name { get; protected set; }\n        /// <summary>\n        /// Gets or sets the args.\n        /// </summary>\n        /// <value>The args.</value>\n        public object[] Args { get; protected set; }\n\n        /// <summary>\n        /// Creates the invocation.\n        /// </summary>\n        /// <param name=\"kind\">The kind.</param>\n        /// <param name=\"name\">The name.</param>\n        /// <param name=\"storedArgs\">The args.</param>\n        /// <returns></returns>\n        public static Invocation Create(InvocationKind kind, String_OR_InvokeMemberName name, params object[] storedArgs)\n        {\n            return new Invocation(kind,name,storedArgs);\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"Invocation\"/> class.\n        /// </summary>\n        /// <param name=\"kind\">The kind.</param>\n        /// <param name=\"name\">The name.</param>\n        /// <param name=\"storedArgs\">The args.</param>\n        public Invocation(InvocationKind kind, String_OR_InvokeMemberName name, params object[] storedArgs)\n        {\n            Kind = kind;\n            Name = name;\n            Args = storedArgs;\n        }\n\n        /// <summary>\n        /// Equalses the specified other.\n        /// </summary>\n        /// <param name=\"other\">The other.</param>\n        /// <returns></returns>\n        public bool Equals(Invocation other)\n        {\n            if (ReferenceEquals(null, other)) return false;\n            if (ReferenceEquals(this, other)) return true;\n            return Equals(other.Kind, Kind) && Equals(other.Name, Name) && (Equals(other.Args, Args) || Enumerable.SequenceEqual(other.Args, Args));\n        }\n\n        /// <summary>\n        /// Determines whether the specified <see cref=\"System.Object\" /> is equal to this instance.\n        /// </summary>\n        /// <param name=\"obj\">The <see cref=\"System.Object\" /> to compare with this instance.</param>\n        /// <returns>\n        ///   <c>true</c> if the specified <see cref=\"System.Object\" /> is equal to this instance; otherwise, <c>false</c>.\n        /// </returns>\n        public override bool Equals(object obj)\n        {\n            if (ReferenceEquals(null, obj)) return false;\n            if (ReferenceEquals(this, obj)) return true;\n            if (obj.GetType() != typeof (Invocation)) return false;\n            return Equals((Invocation) obj);\n        }\n\n        /// <summary>\n        /// Returns a hash code for this instance.\n        /// </summary>\n        /// <returns>\n        /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. \n        /// </returns>\n        public override int GetHashCode()\n        {\n            unchecked\n            {\n                int result = Kind.GetHashCode();\n                result = (result*397) ^ (Name != null ? Name.GetHashCode() : 0);\n                result = (result*397) ^ (Args != null ? Args.GetHashCode() : 0);\n                return result;\n            }\n        }\n\n        /// <summary>\n        /// Invokes the invocation on specified target with specific args.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <param name=\"args\">The args.</param>\n        /// <returns></returns>\n        public virtual object Invoke(object target, params object[] args)\n        {\n            switch (Kind)\n            {\n                case InvocationKind.Constructor:\n                    return Dynamic.InvokeConstructor((Type)target, args);\n                case InvocationKind.Convert:\n                    bool tExplicit = false;\n                    if (Args.Length == 2)\n                        tExplicit = (bool)args[1];\n                    return Dynamic.InvokeConvert(target, (Type)args[0], tExplicit);\n                case InvocationKind.Get:\n                    return Dynamic.InvokeGet(target, Name.Name);\n                case InvocationKind.Set:\n                    Dynamic.InvokeSet(target, Name.Name, args.FirstOrDefault());\n                    return null;\n                case InvocationKind.GetIndex:\n                    return Dynamic.InvokeGetIndex(target, args);\n                case InvocationKind.SetIndex:\n                    Dynamic.InvokeSetIndex(target, args);\n                    return null;\n                case InvocationKind.InvokeMember:\n                    return Dynamic.InvokeMember(target, Name, args);\n                case InvocationKind.InvokeMemberAction:\n                    Dynamic.InvokeMemberAction(target, Name, args);\n                    return null;\n                case InvocationKind.InvokeMemberUnknown:\n                    {\n                        try\n                        {\n                            return Dynamic.InvokeMember(target, Name, args);\n                        }\n                        catch (RuntimeBinderException)\n                        {\n\n                            Dynamic.InvokeMemberAction(target, Name, args);\n                            return null;\n                        }\n                    }\n                case InvocationKind.Invoke:\n                    return Dynamic.Invoke(target, args);\n                case InvocationKind.InvokeAction:\n                    Dynamic.InvokeAction(target, args);\n                    return null;\n                case InvocationKind.InvokeUnknown:\n                    {\n                        try\n                        {\n                            return Dynamic.Invoke(target, args);\n                        }\n                        catch (RuntimeBinderException)\n                        {\n\n                            Dynamic.InvokeAction(target, args);\n                            return null;\n                        }\n                    }\n                case InvocationKind.AddAssign:\n                    Dynamic.InvokeAddAssignMember(target, Name.Name, args.FirstOrDefault());\n                    return null;\n                case InvocationKind.SubtractAssign:\n                    Dynamic.InvokeSubtractAssignMember(target, Name.Name, args.FirstOrDefault());\n                    return null;\n                case InvocationKind.IsEvent:\n                    return Dynamic.InvokeIsEvent(target, Name.Name);\n                default:\n                    throw new InvalidOperationException(\"Unknown Invocation Kind: \" + Kind);\n            }\n\n        }\n\n        /// <summary>\n        /// Invokes the invocation on specified target.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <returns></returns>\n        public virtual object InvokeWithStoredArgs(object target)\n        {\n            return Invoke(target, Args);\n        }\n    }\n}\n"
  },
  {
    "path": "Dynamitey/InvokeArg.cs",
    "content": "﻿// \n//  Copyright 2011 Ekon Benefits\n// \n//    Licensed under the Apache License, Version 2.0 (the \"License\");\n//    you may not use this file except in compliance with the License.\n//    You may obtain a copy of the License at\n// \n//        http://www.apache.org/licenses/LICENSE-2.0\n// \n//    Unless required by applicable law or agreed to in writing, software\n//    distributed under the License is distributed on an \"AS IS\" BASIS,\n//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//    See the License for the specific language governing permissions and\n//    limitations under the License.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\n\n\nnamespace Dynamitey\n{\n    /// <summary>\n    /// Use for Named arguments passed to InvokeMethods\n    /// </summary>\n    \n    public class InvokeArg\n    {\n        /// <summary>\n        /// Performs an explicit conversion from <see cref=\"KeyValuePair{String,Object}\"/> to <see cref=\"InvokeArg\"/>.\n        /// </summary>\n        /// <param name=\"pair\">The pair.</param>\n        /// <returns>The result of the conversion.</returns>\n        public static explicit operator InvokeArg(KeyValuePair<string, object> pair)\n        {\n            return new InvokeArg(pair.Key,pair.Value);\n        }\n\n        /// <summary>\n        /// Create Function can set to variable to make cleaner syntax;\n        /// </summary>\n        public static readonly Func<string, object, InvokeArg> Create =\n            Return<InvokeArg>.Arguments<string, object>((n, v) => new InvokeArg(n, v));\n\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"InvokeArg\"/> class.\n        /// </summary>\n        /// <param name=\"name\">The name.</param>\n        /// <param name=\"value\">The value.</param>\n        public InvokeArg(string name, object value)\n        {\n            Name = name;\n            Value = value;\n        }\n\n        /// <summary>\n        /// Gets or sets the argument name.\n        /// </summary>\n        /// <value>The name.</value>\n        public string Name { get; private set; }\n\n        /// <summary>\n        /// Gets or sets the argument value.\n        /// </summary>\n        /// <value>The value.</value>\n        public object Value { get; private set; }\n    }\n\n    /// <summary>\n    /// InvokeArg that makes it easier to Cast from any IDictionaryValue\n    /// </summary>\n    /// <typeparam name=\"T\"></typeparam>\n    public class InvokeArg<T> : InvokeArg\n    {\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"InvokeArg&lt;T&gt;\"/> class.\n        /// </summary>\n        /// <param name=\"name\">The name.</param>\n        /// <param name=\"value\">The value.</param>\n        public InvokeArg(string name, object value):base(name,value){}\n\n        /// <summary>\n        /// Performs an explicit conversion from <see cref=\"KeyValuePair{String,Object}\"/> to <see cref=\"InvokeArg{T}\"/>.\n        /// </summary>\n        /// <param name=\"pair\">The pair.</param>\n        /// <returns>The result of the conversion.</returns>\n        public static explicit operator InvokeArg<T>(KeyValuePair<string, T> pair)\n        {\n            return new InvokeArg<T>(pair.Key, pair.Value);\n        }\n\n    }\n}\n"
  },
  {
    "path": "Dynamitey/InvokeContext.cs",
    "content": "﻿// \n//  Copyright 2011  Ekon Benefits\n// \n//    Licensed under the Apache License, Version 2.0 (the \"License\");\n//    you may not use this file except in compliance with the License.\n//    You may obtain a copy of the License at\n// \n//        http://www.apache.org/licenses/LICENSE-2.0\n// \n//    Unless required by applicable law or agreed to in writing, software\n//    distributed under the License is distributed on an \"AS IS\" BASIS,\n//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//    See the License for the specific language governing permissions and\n//    limitations under the License.\n\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Dynamitey\n{\n\n\n\n    /// <summary>\n    /// Specific version of InvokeContext which declares a type to be used to invoke static methods.\n    /// </summary>\n    public class StaticContext:InvokeContext\n    {\n        /// <summary>\n        /// Performs an explicit conversion from <see cref=\"System.Type\"/> to <see cref=\"Dynamitey.StaticContext\"/>.\n        /// </summary>\n        /// <param name=\"type\">The type.</param>\n        /// <returns>The result of the conversion.</returns>\n        public static explicit operator StaticContext(Type type)\n        {\n            return new StaticContext(type);\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"StaticContext\"/> class.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        public StaticContext(Type target) : base(target, true, null)\n        {\n        }\n    }\n\n    /// <summary>\n    /// Object that stores a context with a target for dynamic invocation\n    /// </summary>\n    public class InvokeContext\n    {\n\n        /// <summary>\n        /// Create Function can set to variable to make cleaner syntax;\n        /// </summary>\n        public static readonly Func<object, object, InvokeContext> CreateContext =\n            Return<InvokeContext>.Arguments<object, object>((t, c) => new InvokeContext(t, c));\n\n        /// <summary>\n        /// Create Function can set to variable to make cleaner syntax;\n        /// </summary>\n        public static readonly Func<Type, InvokeContext> CreateStatic =\n            Return<InvokeContext>.Arguments<Type>((t) => new InvokeContext(t, true, null));\n\n\n    /// <summary>\n        /// Create Function can set to variable to make cleaner syntax;\n        /// </summary>\n        public static readonly Func<Type, object, InvokeContext> CreateStaticWithContext =\n        Return<InvokeContext>.Arguments<Type, object>((t, c) => new InvokeContext(t, true, c));\n\n\n        /// <summary>\n        /// Gets or sets the target.\n        /// </summary>\n        /// <value>The target.</value>\n        public object Target { get; protected set; }\n        /// <summary>\n        /// Gets or sets the context.\n        /// </summary>\n        /// <value>The context.</value>\n        public Type Context { get; protected set; }\n\n        /// <summary>\n        /// Gets or sets a value indicating whether [static context].\n        /// </summary>\n        /// <value><c>true</c> if [static context]; otherwise, <c>false</c>.</value>\n        public bool StaticContext { get; protected set; }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"InvokeContext\"/> class.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <param name=\"staticContext\">if set to <c>true</c> [static context].</param>\n        /// <param name=\"context\">The context.</param>\n        public InvokeContext(Type target, bool staticContext, object context)\n        {\n            if (context != null && !(context is Type))\n            {\n                context = context.GetType();\n            }\n            Target = target;\n            Context = ((Type)context) ?? target;\n            StaticContext = staticContext;\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"InvokeContext\"/> class.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <param name=\"context\">The context.</param>\n        public InvokeContext(object target, object context)\n        {\n            this.Target = target;\n\n            if (context != null && !(context is Type))\n            {\n                context = context.GetType();\n            }\n\n            Context = (Type)context;\n        }\n    }\n}\n"
  },
  {
    "path": "Dynamitey/InvokeMemberName.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace Dynamitey\n{\n  \n\n    /// <summary>\n    /// String or InvokeMemberName\n    /// </summary>\n    public abstract class String_OR_InvokeMemberName\n    {\n        /// <summary>\n        /// Performs an implicit conversion from <see cref=\"System.String\"/> to <see cref=\"String_OR_InvokeMemberName\"/>.\n        /// </summary>\n        /// <param name=\"name\">The name.</param>\n        /// <returns>The result of the conversion.</returns>\n        public static implicit operator String_OR_InvokeMemberName(string name)\n        {\n            return new InvokeMemberName(name, null);\n        }\n\n\n        /// <summary>\n        /// Gets the name.\n        /// </summary>\n        /// <value>The name.</value>\n        public string Name { get; protected set; }\n        /// <summary>\n        /// Gets the generic args.\n        /// </summary>\n        /// <value>The generic args.</value>\n        public Type[] GenericArgs { get; protected set; }\n\n        /// <summary>\n        /// Gets or sets a value indicating whether this member is special name.\n        /// </summary>\n        /// <value>\n        /// \t<c>true</c> if this instance is special name; otherwise, <c>false</c>.\n        /// </value>\n        public bool IsSpecialName { get;  protected set; }\n    }\n\n    /// <summary>\n    /// Name of Member with associated Generic parameters\n    /// </summary>\n    public sealed class InvokeMemberName:String_OR_InvokeMemberName\n    {\n        /// <summary>\n        /// Create Function can set to variable to make cleaner syntax;\n        /// </summary>\n        public static readonly Func<string, Type[], InvokeMemberName> Create =\n            Return<InvokeMemberName>.Arguments<string, Type[]>((n, a) => new InvokeMemberName(n, a));\n\n        /// <summary>\n        /// Create Function can set to variable to make cleaner syntax;\n        /// </summary>\n        public static readonly Func<string, InvokeMemberName> CreateSpecialName =\n          Return<InvokeMemberName>.Arguments<string>(n => new InvokeMemberName(n, true));\n\n        /// <summary>\n        /// Performs an implicit conversion from <see cref=\"System.String\"/> to <see cref=\"InvokeMemberName\"/>.\n        /// </summary>\n        /// <param name=\"name\">The name.</param>\n        /// <returns>The result of the conversion.</returns>\n          public static implicit operator InvokeMemberName(string name)\n        {\n            return new InvokeMemberName(name,null);\n        }\n\n       \n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"InvokeMemberName\"/> class.\n        /// </summary>\n        /// <param name=\"name\">The name.</param>\n        /// <param name=\"genericArgs\">The generic args.</param>\n        public InvokeMemberName(string name, params Type[] genericArgs)\n        {\n            Name = name;\n            GenericArgs = genericArgs;\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"InvokeMemberName\"/> class.\n        /// </summary>\n        /// <param name=\"name\">The name.</param>\n        /// <param name=\"isSpecialName\">if set to <c>true</c> [is special name].</param>\n        public InvokeMemberName(string name, bool isSpecialName)\n        {\n            Name = name;\n            GenericArgs = new Type[]{};\n            IsSpecialName = isSpecialName;\n        }\n\n        /// <summary>\n        /// Equalses the specified other.\n        /// </summary>\n        /// <param name=\"other\">The other.</param>\n        /// <returns></returns>\n        public bool Equals(InvokeMemberName other)\n        {\n            if (ReferenceEquals(null, other)) return false;\n            if (ReferenceEquals(this, other)) return true;\n            return EqualsHelper(other);\n        }\n        \n        private bool EqualsHelper(InvokeMemberName other)\n        {\n\n            var tGenArgs = GenericArgs;\n            var tOtherGenArgs = other.GenericArgs;\n\n\n            return Equals(other.Name, Name)\n                && !(other.IsSpecialName ^ IsSpecialName)\n                && !(tOtherGenArgs == null ^ tGenArgs == null)\n                && (tGenArgs == null || \n                //Exclusive Or makes sure this doesn't happen\n// ReSharper disable AssignNullToNotNullAttribute\n                tGenArgs.SequenceEqual(tOtherGenArgs));\n// ReSharper restore AssignNullToNotNullAttribute\n        }\n\n        /// <summary>\n        /// Determines whether the specified <see cref=\"System.Object\"/> is equal to this instance.\n        /// </summary>\n        /// <param name=\"obj\">The <see cref=\"System.Object\"/> to compare with this instance.</param>\n        /// <returns>\n        /// \t<c>true</c> if the specified <see cref=\"System.Object\"/> is equal to this instance; otherwise, <c>false</c>.\n        /// </returns>\n        public override bool Equals(object obj)\n        {\n            if (ReferenceEquals(null, obj)) return false;\n            if (ReferenceEquals(this, obj)) return true;\n            if (!(obj is InvokeMemberName)) return false;\n            return EqualsHelper((InvokeMemberName) obj);\n        }\n\n        /// <summary>\n        /// Returns a hash code for this instance.\n        /// </summary>\n        /// <returns>\n        /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. \n        /// </returns>\n        public override int GetHashCode()\n        {\n            unchecked\n            {\n                return (GenericArgs != null ? GenericArgs.Length.GetHashCode() * 397 : 0) ^ (Name.GetHashCode());\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "Dynamitey/PartialApply.cs",
    "content": "﻿using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Dynamic;\nusing System.Linq;\nusing System.Linq.Expressions;\n\nusing System.Text;\nusing System.Reflection;\nusing Dynamitey.Internal.Optimization;\n\nnamespace Dynamitey\n{\n\n\n\n    /// <summary>\n    /// Internal method for subsequent invocations of <see cref=\"Dynamic.Curry(object,System.Nullable{int})\"/>\n    /// </summary>\n   \n    public class PartialApply : DynamicObject, IPartialApply\n    {\n\n        /// <summary>\n        /// Pipes the argument into the function\n        /// </summary>\n        /// <param name=\"argument\">The argument.</param>\n        /// <param name=\"function\">The function.</param>\n        /// <returns></returns>\n        public static dynamic operator |(dynamic argument, PartialApply function)\n        {\n           return ((dynamic)function)(argument);\n        }\n\n        /// <summary>\n        /// Provides implementation for binary operations. Classes derived from the <see cref=\"T:System.Dynamic.DynamicObject\" /> class can override this method to specify dynamic behavior for operations such as addition and multiplication.\n        /// </summary>\n        /// <param name=\"binder\">Provides information about the binary operation. The binder.Operation property returns an <see cref=\"T:System.Linq.Expressions.ExpressionType\" /> object. For example, for the sum = first + second statement, where first and second are derived from the DynamicObject class, binder.Operation returns ExpressionType.Add.</param>\n        /// <param name=\"arg\">The right operand for the binary operation. For example, for the sum = first + second statement, where first and second are derived from the DynamicObject class, <paramref name=\"arg\" /> is equal to second.</param>\n        /// <param name=\"result\">The result of the binary operation.</param>\n        /// <returns>\n        /// true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.)\n        /// </returns>\n        public override bool TryBinaryOperation(BinaryOperationBinder binder, object arg, out object result)\n        {\n            result = null;\n            if (binder.Operation == ExpressionType.LeftShift)\n            {\n                result = ((dynamic)(this))(arg);\n                return true;\n            }\n            return false;\n        }\n\n        /// <summary>\n        /// Provides implementation for type conversion operations. Classes derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class can override this method to specify dynamic behavior for operations that convert an object from one type to another.\n        /// </summary>\n        /// <param name=\"binder\">Provides information about the conversion operation. The binder.Type property provides the type to which the object must be converted. For example, for the statement (String)sampleObject in C# (CType(sampleObject, Type) in Visual Basic), where sampleObject is an instance of the class derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class, binder.Type returns the <see cref=\"T:System.String\"/> type. The binder.Explicit property provides information about the kind of conversion that occurs. It returns true for explicit conversion and false for implicit conversion.</param>\n        /// <param name=\"result\">The result of the type conversion operation.</param>\n        /// <returns>\n        /// true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.)\n        /// </returns>\n        public override bool TryConvert(ConvertBinder binder, out object result)\n        {\n            result = Dynamic.CoerceToDelegate(this, binder.Type);\n\n            return result != null;\n        }\n\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"PartialApply\" /> class.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <param name=\"args\">The args.</param>\n        /// <param name=\"memberName\">Name of the member.</param>\n        /// <param name=\"totalCount\">The total count.</param>\n        /// <param name=\"invocationKind\">Kind of the invocation.</param>\n        public PartialApply(object target, object[] args, string memberName = null, int? totalCount = null, InvocationKind? invocationKind = null)\n        {\n            _target = target;\n            _memberName = memberName;\n            _invocationKind = invocationKind ?? (String.IsNullOrWhiteSpace(_memberName)\n                                     ? InvocationKind.InvokeUnknown\n                                     : InvocationKind.InvokeMemberUnknown);\n            _totalArgCount = totalCount;\n            _args = args;\n        }\n\n       \n        private readonly int? _totalArgCount;\n       \n        private readonly object _target;\n       \n        private readonly string _memberName;\n       \n        private readonly object[] _args;\n       \n        private readonly InvocationKind _invocationKind;\n\n        /// <summary>\n        /// Gets the target.\n        /// </summary>\n        /// <value>The target.</value>\n        public object Target => _target;\n\n        /// <summary>\n        /// Gets the name of the member.\n        /// </summary>\n        /// <value>The name of the member.</value>\n        public string MemberName => _memberName;\n\n        /// <summary>\n        /// Gets the args.\n        /// </summary>\n        /// <value>The args.</value>\n        public object[] Args => _args;\n\n        /// <summary>\n        /// Gets the total arg count.\n        /// </summary>\n        /// <value>The total arg count.</value>\n        public int? TotalArgCount => _totalArgCount;\n\n        /// <summary>\n        /// Gets the kind of the invocation.\n        /// </summary>\n        /// <value>The kind of the invocation.</value>\n        public InvocationKind InvocationKind => _invocationKind;\n\n        private IDictionary<int, CacheableInvocation> _cacheableInvocation = new Dictionary<int, CacheableInvocation>();\n#pragma warning disable 1734\n        /// <summary>\n        /// Provides the implementation for operations that invoke an object. Classes derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class can override this method to specify dynamic behavior for operations such as invoking an object or a delegate.\n        /// </summary>\n        /// <param name=\"binder\">Provides information about the invoke operation.</param>\n        /// <param name=\"args\">The arguments that are passed to the object during the invoke operation. For example, for the sampleObject(100) operation, where sampleObject is derived from the <see cref=\"T:System.Dynamic.DynamicObject\"/> class, <paramref name=\"args[0]\"/> is equal to 100.</param>\n        /// <param name=\"result\">The result of the object invocation.</param>\n        /// <returns>\n        /// true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.\n        /// </returns>\n#pragma warning restore 1734\n        public override bool TryInvoke(InvokeBinder binder, object[] args, out object result)\n        {\n            var tNamedArgs = Util.NameArgsIfNecessary(binder.CallInfo, args);\n            var tNewArgs = _args.Concat(tNamedArgs).ToArray();\n\n            if (_totalArgCount.HasValue && (_totalArgCount - Args.Length - args.Length > 0))\n            //Not Done currying\n            {\n                result = new PartialApply(Target, tNewArgs, MemberName,\n                                   TotalArgCount, InvocationKind);\n\n                return true;\n            }\n            var tInvokeDirect = String.IsNullOrWhiteSpace(_memberName);\n\n            if (tInvokeDirect && binder.CallInfo.ArgumentNames.Count == 0 && _target is Delegate tDel)\n            //Optimization for direct delegate calls\n            {\n                result = tDel.FastDynamicInvoke(tNewArgs);\n                return true;\n            }\n\n\n            Invocation tInvocation;\n            if (binder.CallInfo.ArgumentNames.Count == 0) //If no argument names we can cache the callsite\n            {\n                if (!_cacheableInvocation.TryGetValue(tNewArgs.Length, out var tCacheableInvocation))\n                {\n                    tCacheableInvocation = new CacheableInvocation(InvocationKind, _memberName, argCount: tNewArgs.Length, context: _target);\n                    _cacheableInvocation[tNewArgs.Length] = tCacheableInvocation;\n\n                }\n                tInvocation = tCacheableInvocation;\n            }\n            else\n            {\n                tInvocation = new Invocation(InvocationKind, _memberName);\n            }\n\n            result = tInvocation.Invoke(_target, tNewArgs);\n\n\n            return true;\n        }\n    }\n\n    /// <summary>\n    /// Partial Application Proxy\n    /// </summary>\n    public interface IPartialApply\n    {\n    }\n}\n"
  },
  {
    "path": "Dynamitey/ThisFunctions.cs",
    "content": "﻿\n//  Copyright 2010  Ekon Benefits\n// \n//    Licensed under the Apache License, Version 2.0 (the \"License\");\n//    you may not use this file except in compliance with the License.\n//    You may obtain a copy of the License at\n// \n//        http://www.apache.org/licenses/LICENSE-2.0\n// \n//    Unless required by applicable law or agreed to in writing, software\n//    distributed under the License is distributed on an \"AS IS\" BASIS,\n//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//    See the License for the specific language governing permissions and\n//    limitations under the License.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Reflection;\nusing Dynamitey.Internal.Compat;\n\nnamespace Dynamitey\n{\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate void ThisAction(dynamic @this);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate void ThisAction<in T1>(dynamic @this,T1 arg1);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate void ThisAction<in T1,in T2>(dynamic @this,T1 arg1,T2 arg2);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate void ThisAction<in T1,in T2,in T3>(dynamic @this,T1 arg1,T2 arg2,T3 arg3);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate void ThisAction<in T1,in T2,in T3,in T4>(dynamic @this,T1 arg1,T2 arg2,T3 arg3,T4 arg4);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate void ThisAction<in T1,in T2,in T3,in T4,in T5>(dynamic @this,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate void ThisAction<in T1,in T2,in T3,in T4,in T5,in T6>(dynamic @this,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate void ThisAction<in T1,in T2,in T3,in T4,in T5,in T6,in T7>(dynamic @this,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate void ThisAction<in T1,in T2,in T3,in T4,in T5,in T6,in T7,in T8>(dynamic @this,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7,T8 arg8);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate void ThisAction<in T1,in T2,in T3,in T4,in T5,in T6,in T7,in T8,in T9>(dynamic @this,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7,T8 arg8,T9 arg9);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate void ThisAction<in T1,in T2,in T3,in T4,in T5,in T6,in T7,in T8,in T9,in T10>(dynamic @this,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7,T8 arg8,T9 arg9,T10 arg10);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate void ThisAction<in T1,in T2,in T3,in T4,in T5,in T6,in T7,in T8,in T9,in T10,in T11>(dynamic @this,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7,T8 arg8,T9 arg9,T10 arg10,T11 arg11);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate void ThisAction<in T1,in T2,in T3,in T4,in T5,in T6,in T7,in T8,in T9,in T10,in T11,in T12>(dynamic @this,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7,T8 arg8,T9 arg9,T10 arg10,T11 arg11,T12 arg12);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate void ThisAction<in T1,in T2,in T3,in T4,in T5,in T6,in T7,in T8,in T9,in T10,in T11,in T12,in T13>(dynamic @this,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7,T8 arg8,T9 arg9,T10 arg10,T11 arg11,T12 arg12,T13 arg13);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate void ThisAction<in T1,in T2,in T3,in T4,in T5,in T6,in T7,in T8,in T9,in T10,in T11,in T12,in T13,in T14>(dynamic @this,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7,T8 arg8,T9 arg9,T10 arg10,T11 arg11,T12 arg12,T13 arg13,T14 arg14);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate void ThisAction<in T1,in T2,in T3,in T4,in T5,in T6,in T7,in T8,in T9,in T10,in T11,in T12,in T13,in T14,in T15>(dynamic @this,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7,T8 arg8,T9 arg9,T10 arg10,T11 arg11,T12 arg12,T13 arg13,T14 arg14,T15 arg15);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate void ThisAction<in T1,in T2,in T3,in T4,in T5,in T6,in T7,in T8,in T9,in T10,in T11,in T12,in T13,in T14,in T15,in T16>(dynamic @this,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7,T8 arg8,T9 arg9,T10 arg10,T11 arg11,T12 arg12,T13 arg13,T14 arg14,T15 arg15,T16 arg16);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate TResult ThisFunc<out TResult>(dynamic @this);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate TResult ThisFunc<in T1, out TResult>(dynamic @this,T1 arg1);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate TResult ThisFunc<in T1,in T2, out TResult>(dynamic @this,T1 arg1,T2 arg2);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate TResult ThisFunc<in T1,in T2,in T3, out TResult>(dynamic @this,T1 arg1,T2 arg2,T3 arg3);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate TResult ThisFunc<in T1,in T2,in T3,in T4, out TResult>(dynamic @this,T1 arg1,T2 arg2,T3 arg3,T4 arg4);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate TResult ThisFunc<in T1,in T2,in T3,in T4,in T5, out TResult>(dynamic @this,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate TResult ThisFunc<in T1,in T2,in T3,in T4,in T5,in T6, out TResult>(dynamic @this,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate TResult ThisFunc<in T1,in T2,in T3,in T4,in T5,in T6,in T7, out TResult>(dynamic @this,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate TResult ThisFunc<in T1,in T2,in T3,in T4,in T5,in T6,in T7,in T8, out TResult>(dynamic @this,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7,T8 arg8);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate TResult ThisFunc<in T1,in T2,in T3,in T4,in T5,in T6,in T7,in T8,in T9, out TResult>(dynamic @this,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7,T8 arg8,T9 arg9);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate TResult ThisFunc<in T1,in T2,in T3,in T4,in T5,in T6,in T7,in T8,in T9,in T10, out TResult>(dynamic @this,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7,T8 arg8,T9 arg9,T10 arg10);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate TResult ThisFunc<in T1,in T2,in T3,in T4,in T5,in T6,in T7,in T8,in T9,in T10,in T11, out TResult>(dynamic @this,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7,T8 arg8,T9 arg9,T10 arg10,T11 arg11);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate TResult ThisFunc<in T1,in T2,in T3,in T4,in T5,in T6,in T7,in T8,in T9,in T10,in T11,in T12, out TResult>(dynamic @this,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7,T8 arg8,T9 arg9,T10 arg10,T11 arg11,T12 arg12);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate TResult ThisFunc<in T1,in T2,in T3,in T4,in T5,in T6,in T7,in T8,in T9,in T10,in T11,in T12,in T13, out TResult>(dynamic @this,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7,T8 arg8,T9 arg9,T10 arg10,T11 arg11,T12 arg12,T13 arg13);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate TResult ThisFunc<in T1,in T2,in T3,in T4,in T5,in T6,in T7,in T8,in T9,in T10,in T11,in T12,in T13,in T14, out TResult>(dynamic @this,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7,T8 arg8,T9 arg9,T10 arg10,T11 arg11,T12 arg12,T13 arg13,T14 arg14);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate TResult ThisFunc<in T1,in T2,in T3,in T4,in T5,in T6,in T7,in T8,in T9,in T10,in T11,in T12,in T13,in T14,in T15, out TResult>(dynamic @this,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7,T8 arg8,T9 arg9,T10 arg10,T11 arg11,T12 arg12,T13 arg13,T14 arg14,T15 arg15);\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate TResult ThisFunc<in T1,in T2,in T3,in T4,in T5,in T6,in T7,in T8,in T9,in T10,in T11,in T12,in T13,in T14,in T15,in T16, out TResult>(dynamic @this,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7,T8 arg8,T9 arg9,T10 arg10,T11 arg11,T12 arg12,T13 arg13,T14 arg14,T15 arg15,T16 arg16);\n\t\n\t/// <summary>\n    /// Extension method for Dealing with Special Delegate Type\n    /// </summary>\n\tpublic static class ThisDelegate{\n\t\tprivate static readonly HashSet<Type> _specialThisDels = new HashSet<Type>(){\n\t\t\t\ttypeof(ThisAction),\n\t\t\t\ttypeof(ThisFunc<>),\n\t\t\t\n\t\t\t\ttypeof(ThisAction<,>),\n\t\t\t\ttypeof(ThisFunc<,>),\n\t\t\t\n\t\t\t\ttypeof(ThisAction<,,>),\n\t\t\t\ttypeof(ThisFunc<,,>),\n\t\t\t\n\t\t\t\ttypeof(ThisAction<,,,>),\n\t\t\t\ttypeof(ThisFunc<,,,>),\n\t\t\t\n\t\t\t\ttypeof(ThisAction<,,,,>),\n\t\t\t\ttypeof(ThisFunc<,,,,>),\n\t\t\t\n\t\t\t\ttypeof(ThisAction<,,,,,>),\n\t\t\t\ttypeof(ThisFunc<,,,,,>),\n\t\t\t\n\t\t\t\ttypeof(ThisAction<,,,,,,>),\n\t\t\t\ttypeof(ThisFunc<,,,,,,>),\n\t\t\t\n\t\t\t\ttypeof(ThisAction<,,,,,,,>),\n\t\t\t\ttypeof(ThisFunc<,,,,,,,>),\n\t\t\t\n\t\t\t\ttypeof(ThisAction<,,,,,,,,>),\n\t\t\t\ttypeof(ThisFunc<,,,,,,,,>),\n\t\t\t\n\t\t\t\ttypeof(ThisAction<,,,,,,,,,>),\n\t\t\t\ttypeof(ThisFunc<,,,,,,,,,>),\n\t\t\t\n\t\t\t\ttypeof(ThisAction<,,,,,,,,,,>),\n\t\t\t\ttypeof(ThisFunc<,,,,,,,,,,>),\n\t\t\t\n\t\t\t\ttypeof(ThisAction<,,,,,,,,,,,>),\n\t\t\t\ttypeof(ThisFunc<,,,,,,,,,,,>),\n\t\t\t\n\t\t\t\ttypeof(ThisAction<,,,,,,,,,,,,>),\n\t\t\t\ttypeof(ThisFunc<,,,,,,,,,,,,>),\n\t\t\t\n\t\t\t\ttypeof(ThisAction<,,,,,,,,,,,,,>),\n\t\t\t\ttypeof(ThisFunc<,,,,,,,,,,,,,>),\n\t\t\t\n\t\t\t\ttypeof(ThisAction<,,,,,,,,,,,,,,>),\n\t\t\t\ttypeof(ThisFunc<,,,,,,,,,,,,,,>),\n\t\t\t\n\t\t\t\ttypeof(ThisAction<,,,,,,,,,,,,,,,>),\n\t\t\t\ttypeof(ThisFunc<,,,,,,,,,,,,,,,>),\n\t\t\t\ttypeof(ThisFunc<,,,,,,,,,,,,,,,,>),\n\t\t};\n\n\t\t/// <summary>\n        /// Determines whether [is special this delegate] [the specified del].\n        /// </summary>\n        /// <param name=\"del\">The del.</param>\n        /// <returns>\n        /// \t<c>true</c> if [is special this delegate] [the specified del]; otherwise, <c>false</c>.\n        /// </returns>\n\t\tpublic static bool IsSpecialThisDelegate(this Delegate del){\n\t\t\t\tvar tType =del.GetType();\n\t\t\t\tif(!tType.GetTypeInfo().IsGenericType) return false;\n\t\t\t\tvar tGenDel =del.GetType().GetGenericTypeDefinition();\n\t\t\t\tvar tReturn =_specialThisDels.Contains(tGenDel);\n\t\t\t\treturn tReturn;\n\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "Dynamitey/ThisFunctions.tt",
    "content": "﻿<#@ template language=\"C#\" #>\n<#@ output extension=\"cs\" #>\n<#@ assembly  name=\"System.Core\" #>\n<#@ import namespace=\"System.Linq\" #>\n\n//  Copyright 2010  Ekon Benefits\n// \n//    Licensed under the Apache License, Version 2.0 (the \"License\");\n//    you may not use this file except in compliance with the License.\n//    You may obtain a copy of the License at\n// \n//        http://www.apache.org/licenses/LICENSE-2.0\n// \n//    Unless required by applicable law or agreed to in writing, software\n//    distributed under the License is distributed on an \"AS IS\" BASIS,\n//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//    See the License for the specific language governing permissions and\n//    limitations under the License.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Reflection;\nusing Dynamitey.Internal.Compat;\n\nnamespace Dynamitey\n{\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate void ThisAction(dynamic @this);\n<# for(int i=1; i<=16; i++){\n\tvar tArgs = String.Concat(Enumerable.Range(2,i-1).Select(it=>String.Format(\",in T{0}\",it)));\n\tvar tParms = String.Concat(Enumerable.Range(1,i).Select(it=>String.Format(\",T{0} arg{0}\",it)));\n#>\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate void ThisAction<in T1<#=tArgs#>>(dynamic @this<#=tParms#>);\n<# } #>\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate TResult ThisFunc<out TResult>(dynamic @this);\n<# for(int i=1; i<=16; i++){\n\tvar tArgs = String.Concat(Enumerable.Range(2,i-1).Select(it=>String.Format(\",in T{0}\",it)));\n\tvar tParms = String.Concat(Enumerable.Range(1,i).Select(it=>String.Format(\",T{0} arg{0}\",it)));\n#>\n    /// <summary>\n    /// Special Delegate used to make impromptu object methods first parameter is this.\n    /// </summary>\n\tpublic delegate TResult ThisFunc<in T1<#=tArgs#>, out TResult>(dynamic @this<#=tParms#>);\n<# } #>\n\t\n\t/// <summary>\n    /// Extension method for Dealing with Special Delegate Type\n    /// </summary>\n\tpublic static class ThisDelegate{\n\t\tprivate static readonly HashSet<Type> _specialThisDels = new HashSet<Type>(){\n\t\t\t\ttypeof(ThisAction),\n\t\t\t\ttypeof(ThisFunc<>),\n<# for(int i=1; i<=16; i++){\n\t\tvar tCommas = String.Concat(Enumerable.Repeat(\",\",i));\n#>\n<# if(i!=16){#>\t\t\t\n\t\t\t\ttypeof(ThisAction<<#=tCommas#>>),\n<# } #>\n\t\t\t\ttypeof(ThisFunc<<#=tCommas#>>),\n<# } #>\n\t\t};\n\n\t\t/// <summary>\n        /// Determines whether [is special this delegate] [the specified del].\n        /// </summary>\n        /// <param name=\"del\">The del.</param>\n        /// <returns>\n        /// \t<c>true</c> if [is special this delegate] [the specified del]; otherwise, <c>false</c>.\n        /// </returns>\n\t\tpublic static bool IsSpecialThisDelegate(this Delegate del){\n\t\t\t\tvar tType =del.GetType();\n\t\t\t\tif(!tType.GetTypeInfo().IsGenericType) return false;\n\t\t\t\tvar tGenDel =del.GetType().GetGenericTypeDefinition();\n\t\t\t\tvar tReturn =_specialThisDels.Contains(tGenDel);\n\t\t\t\treturn tReturn;\n\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "Dynamitey/Tupler.cs",
    "content": "﻿// \n//  Copyright 2013 Ekon Benefits\n// \n//    Licensed under the Apache License, Version 2.0 (the \"License\");\n//    you may not use this file except in compliance with the License.\n//    You may obtain a copy of the License at\n// \n//        http://www.apache.org/licenses/LICENSE-2.0\n// \n//    Unless required by applicable law or agreed to in writing, software\n//    distributed under the License is distributed on an \"AS IS\" BASIS,\n//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//    See the License for the specific language governing permissions and\n//    limitations under the License.\n\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Reflection;\nusing System.Text;\nusing Dynamitey.DynamicObjects;\nusing Dynamitey.Internal.Optimization;\nusing Dynamitey.Internal.Compat;\n\nnamespace Dynamitey\n{\n    /// <summary>\n    /// Dynamically Dealing with Tuples\n    /// </summary>\n\n    public static class Tupler\n    {\n        private class TuplerFix\n        {\n            private Tuple<T1, T2, T3, T4, T5, T6, T7, T8> Create<T1, T2, T3, T4, T5, T6, T7, T8>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, T8 item8)\n            {\n                return new Tuple<T1, T2, T3, T4, T5, T6, T7, T8>(item1, item2, item3, item4, item5, item6, item7, item8);\n            }\n        }\n       \n        private static TuplerFix TuplerHelper = new TuplerFix();\n        private static InvokeContext StaticTuple = InvokeContext.CreateStatic(typeof (Tuple));\n\n        /// <summary>\n        /// Creates a Tuple with arg runtime types.\n        /// </summary>\n        /// <param name=\"args\">The args.</param>\n        /// <returns></returns>\n        public static dynamic Create(params object[] args)\n        {\n            return args.ToTuple();\n        }\n\n        /// <summary>\n        /// Enumerable to tuple.\n        /// </summary>\n        /// <param name=\"enumerable\">The enumerable.</param>\n        /// <returns></returns>\n        public static dynamic ToTuple(this IEnumerable enumerable)\n        {\n            var items = enumerable as IEnumerable<object> ?? enumerable.Cast<object>();\n            if (items.Count() < 8)\n            {\n                return Dynamic.InvokeMember(StaticTuple, \"Create\", items.ToArray());\n            }\n\n            return Dynamic.InvokeMember(TuplerHelper, \"Create\",\n                                        items.Take(7).Concat(new object[] { items.Skip(7).ToTuple() }).ToArray());\n        }\n\n        /// <summary>\n        /// Firsts item of the specified tuple.\n        /// </summary>\n        /// <param name=\"tuple\">The tuple.</param>\n        /// <returns></returns>\n        public static dynamic First(object tuple)\n        {\n            return Index(tuple, 0);\n        }\n\n        /// <summary>\n        /// Second item of the specified tuple.\n        /// </summary>\n        /// <param name=\"tuple\">The tuple.</param>\n        /// <returns></returns>\n        public static dynamic Second(object tuple)\n        {\n            return Index(tuple, 1);\n        }\n\n        /// <summary>\n        /// Lasts item of the specified tuple.\n        /// </summary>\n        /// <param name=\"tuple\">The tuple.</param>\n        /// <returns></returns>\n        public static dynamic Last(object tuple)\n        {\n            return Index(tuple, Size(tuple)-1);\n        }\n\n        /// <summary>\n        /// Convert to list.\n        /// </summary>\n        /// <param name=\"tuple\">The tuple.</param>\n        /// <returns></returns>\n        public static IList<dynamic> ToList(object tuple)\n        {\n\n            var list = new List<dynamic>();\n            HelperToList(list, tuple, safe:false);\n            return list;\n\n        }\n\n\n        private static void HelperToList(List<dynamic> list, object tuple, bool safe)\n        {\n            if(HelperIsTuple(tuple, out var type, out var generic, out var size, safe))\n            {\n                for (int i = 0; i < 7 && i < size; i++)\n                {\n                    list.Add(HelperIndex(tuple,i,safe:true));\n                }\n\n                if (size == 8)\n                {\n                    HelperToList(list, (object)(((dynamic)tuple).Rest), true);\n                }\n            }\n        }\n\n        /// <summary>\n        /// Gets value at the index of the specified tuple.\n        /// </summary>\n        /// <param name=\"tuple\">The tuple.</param>\n        /// <param name=\"index\">The index.</param>\n        /// <returns></returns>\n        /// <exception cref=\"System.ArgumentException\">index must be greater than or equalto 0;index</exception>\n        public static dynamic Index(object tuple, int index)\n        {\n            return HelperIndex(tuple, index, false);\n        }\n\n        private static dynamic HelperIndex(object tuple, int index, bool safe)\n        {\n            var item = index + 1;\n            if (!safe && item < 1)\n            {\n                throw new ArgumentException(\"index must be greater than or equalto 0\", nameof(index));\n            }\n\n            if (!safe && item > Size(tuple))\n            {\n                throw new ArgumentException(\"index must be less than size\", nameof(index));\n            }\n\n            if (!safe && !IsTuple(tuple))\n            {\n                return tuple;\n            }\n\n            if( item < 8)\n                return InvokeHelper.TupleItem(tuple, item);\n\n            object newtarget = ((dynamic) tuple).Rest;\n            return HelperIndex(newtarget, item - 8, true);\n          \n        }\n\n        /// <summary>\n        /// Determines whether the specified target is a tuple.\n        /// </summary>\n        /// <param name=\"target\">The target.</param>\n        /// <returns>\n        ///   <c>true</c> if the specified target is tuple; otherwise, <c>false</c>.\n        /// </returns>\n        public static bool IsTuple(object target)\n        {\n            return HelperIsTuple(target, out var type, out var genericType, out var size, false);\n        }\n\n        private static bool HelperIsTuple(object target, out Type type, out Type genericeType, out int size, bool safe)\n        {\n            genericeType = typeof(object);\n            size = 1;\n            type = null;\n            if (target == null)\n                return false;\n            type = target as Type ?? target.GetType();\n\n\n            if (safe || type.GetTypeInfo().IsGenericType)\n            {\n                genericeType = type.GetGenericTypeDefinition();\n            }\n\n            return InvokeHelper.TupleArgs.TryGetValue(genericeType, out size);\n\n        }\n\n        /// <summary>\n        /// Gets the size of the tuple\n        /// </summary>\n        /// <param name=\"tuple\">The tuple.</param>\n        /// <returns></returns>\n        public static int Size(object tuple)\n        {\n            return HelperSize(tuple, false);\n        }\n\n        private static int HelperSize(object tuple, bool safe)\n        {\n            if (HelperIsTuple(tuple, out var type, out var genericType, out var size, safe))\n            {\n                if (size == 8)\n                {\n                    var lasttype = type.GetTypeInfo().GetGenericArguments()[7];\n                    size = size + HelperSize(lasttype, true) - 1;\n                }\n            }\n            return size;\n        }\n    }\n}\n"
  },
  {
    "path": "Dynamitey.sln",
    "content": "﻿\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 17\nVisualStudioVersion = 17.7.34202.233\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"Tests\", \"Tests\", \"{691EBA79-CAA4-4670-BC8B-4537F990ADBF}\"\nEndProject\nProject(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"Tests\", \"Tests\\Tests.csproj\", \"{C33F07DB-7ACB-4081-92C2-BB739CB605C0}\"\nEndProject\nProject(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"SupportLibrary\", \"SupportLibrary\\SupportLibrary.csproj\", \"{18E19833-D47E-4A7F-AE64-31E28FEF8728}\"\nEndProject\nProject(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"Dynamitey\", \"Dynamitey\\Dynamitey.csproj\", \"{8902AFBA-4ACA-4880-B606-ADEC6BB21A1B}\"\nEndProject\nProject(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"Solution Items\", \"Solution Items\", \"{3535FA34-121F-4DEB-97C5-4A90E54AEE94}\"\n\tProjectSection(SolutionItems) = preProject\n\t\tVersion.props = Version.props\n\t\tReadme.md = Readme.md\n\tEndProjectSection\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{C33F07DB-7ACB-4081-92C2-BB739CB605C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{C33F07DB-7ACB-4081-92C2-BB739CB605C0}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{C33F07DB-7ACB-4081-92C2-BB739CB605C0}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{C33F07DB-7ACB-4081-92C2-BB739CB605C0}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{18E19833-D47E-4A7F-AE64-31E28FEF8728}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{18E19833-D47E-4A7F-AE64-31E28FEF8728}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{18E19833-D47E-4A7F-AE64-31E28FEF8728}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{18E19833-D47E-4A7F-AE64-31E28FEF8728}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{8902AFBA-4ACA-4880-B606-ADEC6BB21A1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{8902AFBA-4ACA-4880-B606-ADEC6BB21A1B}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{8902AFBA-4ACA-4880-B606-ADEC6BB21A1B}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{8902AFBA-4ACA-4880-B606-ADEC6BB21A1B}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(NestedProjects) = preSolution\n\t\t{C33F07DB-7ACB-4081-92C2-BB739CB605C0} = {691EBA79-CAA4-4670-BC8B-4537F990ADBF}\n\t\t{18E19833-D47E-4A7F-AE64-31E28FEF8728} = {691EBA79-CAA4-4670-BC8B-4537F990ADBF}\n\tEndGlobalSection\nEndGlobal\n"
  },
  {
    "path": "Dynamitey.sln.DotSettings",
    "content": "﻿<wpf:ResourceDictionary xml:space=\"preserve\" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" xmlns:s=\"clr-namespace:System;assembly=mscorlib\" xmlns:ss=\"urn:shemas-jetbrains-com:settings-storage-xaml\" xmlns:wpf=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\">\n\t<s:String x:Key=\"/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=DB/@EntryIndexedValue\">DB</s:String>\n\t<s:String x:Key=\"/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SL/@EntryIndexedValue\">SL</s:String>\n\t<s:Boolean x:Key=\"/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EdotCover_002EIde_002ECore_002EFilterManagement_002EModel_002ESolutionFilterSettingsManagerMigrateSettings/@EntryIndexedValue\">True</s:Boolean>\n\t<s:String x:Key=\"/Default/FilterSettingsManager/CoverageFilterXml/@EntryValue\">&lt;data&gt;&lt;IncludeFilters /&gt;&lt;ExcludeFilters /&gt;&lt;/data&gt;</s:String>\n\t<s:String x:Key=\"/Default/FilterSettingsManager/AttributeFilterXml/@EntryValue\">&lt;data /&gt;</s:String>\n\t<s:Boolean x:Key=\"/Default/UserDictionary/Words/=Cacheable/@EntryIndexedValue\">True</s:Boolean>\n\t<s:Boolean x:Key=\"/Default/UserDictionary/Words/=Defacto/@EntryIndexedValue\">True</s:Boolean>\n\t<s:Boolean x:Key=\"/Default/UserDictionary/Words/=Dynamitey/@EntryIndexedValue\">True</s:Boolean>\n\t<s:Boolean x:Key=\"/Default/UserDictionary/Words/=Ekon/@EntryIndexedValue\">True</s:Boolean>\n\t<s:Boolean x:Key=\"/Default/UserDictionary/Words/=invokeable/@EntryIndexedValue\">True</s:Boolean>\n\t<s:Boolean x:Key=\"/Default/UserDictionary/Words/=lgtm/@EntryIndexedValue\">True</s:Boolean>\n</wpf:ResourceDictionary>\n"
  },
  {
    "path": "License.txt",
    "content": "Apache License, Version 2.0\nApache License\nVersion 2.0, January 2004\nhttp://www.apache.org/licenses/\n\nTERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n1. Definitions.\n\n\"License\" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.\n\n\"Licensor\" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.\n\n\"Legal Entity\" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, \"control\" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.\n\n\"You\" (or \"Your\") shall mean an individual or Legal Entity exercising permissions granted by this License.\n\n\"Source\" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.\n\n\"Object\" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.\n\n\"Work\" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).\n\n\"Derivative Works\" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.\n\n\"Contribution\" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, \"submitted\" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as \"Not a Contribution.\"\n\n\"Contributor\" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.\n\n2. Grant of Copyright License.\n\nSubject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.\n\n3. Grant of Patent License.\n\nSubject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.\n\n4. Redistribution.\n\nYou may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:\n\nYou must give any other recipients of the Work or Derivative Works a copy of this License; and\nYou must cause any modified files to carry prominent notices stating that You changed the files; and\nYou must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and\nIf the Work includes a \"NOTICE\" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.\nYou may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.\n\n5. Submission of Contributions.\n\nUnless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.\n\n6. Trademarks.\n\nThis License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.\n\n7. Disclaimer of Warranty.\n\nUnless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.\n\n8. Limitation of Liability.\n\nIn no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.\n\n9. Accepting Warranty or Additional Liability.\n\nWhile redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.\n\nEND OF TERMS AND CONDITIONS\n\nAPPENDIX: How to apply the Apache License to your work\n\nTo apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets \"[]\" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same \"printed page\" as the copyright notice for easier identification within third-party archives.\n\n   Copyright [yyyy] [name of copyright owner]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n     http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License."
  },
  {
    "path": "NuGet.config",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<configuration>\n  <config>\n    <add key=\"globalPackagesFolder\" value=\"packages\" />\n  </config>\n  <packageSources>\n    <add key=\"nuget.org\" value=\"https://api.nuget.org/v3/index.json\" protocolVersion=\"3\" />\n  </packageSources>\n</configuration>"
  },
  {
    "path": "Readme.md",
    "content": "# Dynamitey  \n\n(pronounced dyna-mighty) flexes DLR muscle to do meta-mazing things in .net\n\nDynamitey is available Nuget [![NuGet](https://img.shields.io/nuget/dt/Dynamitey.svg)](https://www.nuget.org/packages/Dynamitey/)\n\nFramework | Platform | Status\n--------- | -------- | ------\nAll | Windows | [![Actions Status](https://github.com/ekonbenefits/dynamitey/actions/workflows/dotnet48.yml/badge.svg)](https://github.com/ekonbenefits/dynamitey/actions/workflows/dotnet48.yml)\n.NET Core | Linux/Mac | [![Actions Status](https://github.com/ekonbenefits/dynamitey/actions/workflows/dotnet.yml/badge.svg)](https://github.com/ekonbenefits/dynamitey/actions/workflows/dotnet.yml)\n\nCompiled For|\n--------|\n.Net Std 2.0 | \n.Net 4.0  |\n\n\n\n[Change Log](https://github.com/ekonbenefits/dynamitey/releases)\n\nInstall with [Nuget](https://nuget.org/packages/Dynamitey/):\n```\nPM> Install-Package Dynamitey\n```\n\n# Meta-mazing Features\n  \n  - Easy Fast DLR based Reflection -- [oooo](https://github.com/ekonbenefits/dynamitey/wiki/UsageReallyLateBinding)\n  - Clean syntax for using types from late bound libraries -- [ahhh](https://github.com/ekonbenefits/dynamitey/wiki/LateType)\n  - Dynamic Currying -- [whaaa?](https://github.com/ekonbenefits/dynamitey/wiki/UsageCurry)\n  - Manipulation of Tuples -- [wowzers](https://github.com/ekonbenefits/dynamitey/blob/master/Tests/TuplerTest.cs)\n  - Inline Object Graph Intialization Syntax [whoa](https://github.com/ekonbenefits/dynamitey/wiki/UsageBuilder)\n  - DynamicObject base types for many things -- [jenkies](https://github.com/ekonbenefits/dynamitey/wiki/UsageDynamic)\n  - Extension to instance method conversion -- [o_O](https://github.com/ekonbenefits/dynamitey/blob/master/Tests/Linq.cs)\n"
  },
  {
    "path": "SupportLibrary/SupportLibrary.csproj",
    "content": "﻿<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <TargetFramework>netstandard2.0</TargetFramework>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <PackageReference Include=\"Microsoft.CSharp\" Version=\"4.7.0\" />\n    <PackageReference Include=\"System.Collections\" Version=\"4.3.0\" />\n    <PackageReference Include=\"System.Runtime\" Version=\"4.3.0\" />\n  </ItemGroup>\n\n</Project>"
  },
  {
    "path": "SupportLibrary/SupportTypes.cs",
    "content": "﻿using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing Dynamitey;\n\nnamespace Dynamitey.SupportLibrary\n{\n    public class TestEvent\n    {\n        public event EventHandler<EventArgs> Event;\n\n        public void OnEvent(object obj, EventArgs args)\n        {\n            if (Event != null)\n                Event(obj, args);\n        }\n    }\n\n    public static class TestFuncs\n    {\n        public static Func<int, int> Plus3\n        {\n            get { return x => x + 3; }\n        }\n    }\n\n    public class PublicType\n    {\n        public static object InternalInstance => new InternalType();\n\n        public bool PrivateMethod(object param)\n        {\n            return param != null;\n        }\n    }\n\n\n    internal class InternalType\n    {\n        public bool InternalMethod(object param)\n        {\n            return param != null;\n        }\n    }\n\n\n\n    public interface IDynamicArg\n    {\n        dynamic ReturnIt(dynamic arg);\n\n        bool Params(params dynamic[] args);\n    }\n\n    public class PocoNonDynamicArg\n    {\n        public int ReturnIt(int i)\n        {\n            return i;\n        }\n\n\n        public List<string> ReturnIt(List<string> i)\n        {\n            return i;\n        }\n\n        public bool Params(object fallback)\n        {\n            return false;\n        }\n\n        public bool Params(params int[] args)\n        {\n            return true;\n        }\n    }\n\n    public static class StaticType\n    {\n        public static TReturn Create<TReturn>(int type)\n        {\n            return default(TReturn);\n        }\n\n        public static bool Test => true;\n\n        public static int TestSet { get; set; }\n    }\n\n    public interface ISimpeleClassProps\n    {\n        string Prop1 { get; }\n\n        long Prop2 { get; }\n\n        Guid Prop3 { get; }\n    }\n\n    public interface IInheritProp : ISimpeleClassProps\n    {\n        PropPoco ReturnProp { get; set; }\n    }\n\n\n    public interface IPropPocoProp\n    {\n        PropPoco ReturnProp { get; set; }\n    }\n\n    public interface IEventCollisions\n    {\n        int Event { get; set; }\n    }\n\n\n    public interface IEvent\n    {\n        event EventHandler<EventArgs> Event;\n        void OnEvent(object obj, EventArgs args);\n    }\n\n    public class PocoEvent\n    {\n        public event EventHandler<EventArgs> Event;\n\n        public void OnEvent(object obj, EventArgs args)\n        {\n            if (Event != null)\n                Event(obj, args);\n        }\n    }\n\n\n    public class PocoOptConstructor\n    {\n        public string One { get; set; }\n        public string Two { get; set; }\n        public string Three { get; set; }\n\n        public PocoOptConstructor(string one = \"-1\", string two = \"-2\", string three = \"-3\")\n        {\n            One = one;\n            Two = two;\n            Three = three;\n        }\n    }\n\n    public enum TestEnum\n    {\n        None,\n        One,\n        Two\n    }\n\n    public interface IDynamicDict\n    {\n        int Test1 { get; }\n\n        long Test2 { get; }\n\n        TestEnum Test3 { get; }\n\n        TestEnum Test4 { get; }\n\n        dynamic TestD { get; }\n    }\n\n    public interface INonDynamicDict\n    {\n        int Test1 { get; }\n\n        long Test2 { get; }\n\n        TestEnum Test3 { get; }\n\n        TestEnum Test4 { get; }\n\n        IDictionary<string, object> TestD { get; }\n    }\n\n    public interface ISimpleStringProperty\n    {\n        int Length { get; }\n\n    }\n\n    public interface IRobot\n    {\n        string Name { get; }\n    }\n    public class Robot\n    {\n        public string Name { get; set; }\n    }\n\n    public interface ISimpleStringMethod\n    {\n        bool StartsWith(string value);\n\n    }\n\n    public interface ISimpleStringMethodCollision\n    {\n        int StartsWith(string value);\n\n    }\n\n    public interface ISimpeleClassMeth\n    {\n        void Action1();\n        void Action2(bool value);\n        string Action3();\n    }\n\n    public interface ISimpeleClassMeth2 : ISimpeleClassMeth\n    {\n\n        string Action4(int arg);\n    }\n\n    public interface IGenericMeth\n    {\n        string Action<T>(T arg);\n\n        T Action2<T>(T arg);\n    }\n\n    public interface IStringIntIndexer\n    {\n        string this[int index] { get; set; }\n    }\n\n    public interface IObjectStringIndexer\n    {\n        object this[string index] { get; set; }\n    }\n\n    public interface IGenericMethWithConstraints\n    {\n        string Action<T>(T arg) where T : class;\n        string Action2<T>(T arg) where T : IComparable;\n    }\n\n    public interface IGenericType<T>\n    {\n        string Funct(T arg);\n\n\n    }\n\n    public interface IGenericTypeConstraints<T> where T : class\n    {\n        string Funct(T arg);\n\n    }\n\n\n    public interface IOverloadingMethod\n    {\n        string Func(int arg);\n\n        string Func(object arg);\n    }\n\n\n    public class PropPoco\n    {\n        public string Prop1 { get; set; }\n\n        public long Prop2 { get; set; }\n\n        public Guid Prop3 { get; set; }\n\n        public int Event { get; set; }\n    }\n\n    public struct PropStruct\n    {\n        public string Prop1 { get; set; }\n\n        public long Prop2 { get; set; }\n\n        public Guid Prop3 { get; set; }\n\n        public int Event { get; set; }\n    }\n\n\n    public interface IVoidMethod\n    {\n        void Action();\n    }\n\n    public class VoidMethodPoco\n    {\n        public void Action()\n        {\n\n        }\n    }\n\n    public class OverloadingMethPoco\n    {\n        public string Func(int arg)\n        {\n            return \"int\";\n        }\n\n        public string Func(object arg)\n        {\n            return \"object\";\n        }\n        public string Func(object arg, object arg2, object arg3, object arg4, object arg5, object arg6)\n        {\n            return \"object 6\";\n        }\n\n        public string Func(object one = null, object two = null, object three = null)\n        {\n            return \"object named\";\n        }\n    }\n\n    /// <summary>\n    /// Dynamic Delegates need to return object or void, first parameter should be a CallSite, second object, followed by the expected arguments\n    /// </summary>\n    public delegate object DynamicTryString(CallSite callsite, object target, out string result);\n\n    public class MethOutPoco\n    {\n        public bool Func(out string result)\n        {\n            result = \"success\";\n            return true;\n        }\n    }\n\n\n    public class Thing { }\n\n    public interface IGenericTest\n    {\n        List<T> GetThings<T>(Guid test) where T : Thing;\n    }\n    public class OtherThing\n    {\n\n\n        List<T> GetThings<T>(Guid test) where T : Thing\n        {\n            return new List<T>();\n        }\n\n    }\n\n    public class ForwardGenericMethodsTestClass\n    {\n        public string Value { get; set; }\n\n        public T Create<T>(int arg) where T : ForwardGenericMethodsTestClass, new()\n        {\n            return new T { Value = \"test\" + arg };\n        }\n    }\n\n\n    public class GenericMethOutPoco\n    {\n        public bool Func<T>(out T result)\n        {\n            result = default(T);\n            return true;\n        }\n    }\n\n    public interface IGenericMethodOut\n    {\n        bool Func<T>(out T result);\n    }\n\n    public interface IMethodOut2\n    {\n        bool Func(out int result);\n    }\n\n\n    public class MethRefPoco\n    {\n        public bool Func(ref int result)\n        {\n            result = result + 2;\n            return true;\n        }\n\n    }\n\n    public class PocoAdder\n    {\n        public int Add(int x, int y)\n        {\n            return x + y;\n        }\n    }\n\n    public class PocoDoubleProp : IInheritProp, IPropPocoProp, IEnumerable\n    {\n        public string Prop1 => throw new NotImplementedException();\n\n        public long Prop2 => throw new NotImplementedException();\n\n        public Guid Prop3 => throw new NotImplementedException();\n\n        public PropPoco ReturnProp\n        {\n            get => throw new NotImplementedException();\n            set => throw new NotImplementedException();  //lgtm [cs/unused-property-value]\n        }\n\n        PropPoco IPropPocoProp.ReturnProp\n        {\n            get => throw new NotImplementedException();\n            set => throw new NotImplementedException(); //lgtm [cs/unused-property-value]\n        }\n\n        IEnumerator IEnumerable.GetEnumerator()\n        {\n            throw new NotImplementedException();\n        }\n    }\n\n    public class PocoCollection : IList\n    {\n        public IEnumerator GetEnumerator()\n        {\n            throw new NotImplementedException();\n        }\n\n        public void CopyTo(Array array, int index)\n        {\n            throw new NotImplementedException();\n        }\n\n        public int Count => throw new NotImplementedException();\n\n        public object SyncRoot => throw new NotImplementedException();\n\n        public bool IsSynchronized => throw new NotImplementedException();\n\n        public int Add(object value)\n        {\n            throw new NotImplementedException();\n        }\n\n        public bool Contains(object value)\n        {\n            throw new NotImplementedException();\n        }\n\n        public void Clear()\n        {\n            throw new NotImplementedException();\n        }\n\n        public int IndexOf(object value)\n        {\n            throw new NotImplementedException();\n        }\n\n        public void Insert(int index, object value)\n        {\n            throw new NotImplementedException();\n        }\n\n        public void Remove(object value)\n        {\n            throw new NotImplementedException();\n        }\n\n        public void RemoveAt(int index)\n        {\n            throw new NotImplementedException();\n        }\n\n        public object this[int index]\n        {\n            get => throw new NotImplementedException();\n            set => throw new NotImplementedException();\n        }\n\n        public bool IsReadOnly => throw new NotImplementedException();\n\n        public bool IsFixedSize => throw new NotImplementedException();\n    }\n\n}\n"
  },
  {
    "path": "TestResult.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<test-run id=\"2\" testcasecount=\"214\" result=\"Passed\" total=\"182\" passed=\"182\" failed=\"0\" inconclusive=\"0\" skipped=\"0\" asserts=\"385\" engine-version=\"3.7.0.0\" clr-version=\"4.0.30319.42000\" start-time=\"2017-08-18 02:57:59Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"4.993157\">\n  <command-line><![CDATA[/Users/jay/github/dynamitey/packages/nunit.consolerunner/3.7.0/tools/nunit3-console.exe --labels=All \"--where=cat != Performance\" ./Tests/bin/Release/net462/Tests.exe]]></command-line>\n  <filter>\n    <not>\n      <cat>Performance</cat>\n    </not>\n  </filter>\n  <test-suite type=\"Assembly\" id=\"0-1224\" name=\"Tests.exe\" fullname=\"/Users/jay/github/dynamitey/Tests/bin/Release/net462/Tests.exe\" runstate=\"Runnable\" testcasecount=\"214\" result=\"Passed\" start-time=\"2017-08-18 02:58:00Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"4.067841\" total=\"182\" passed=\"182\" failed=\"0\" warnings=\"0\" inconclusive=\"0\" skipped=\"0\" asserts=\"385\">\n    <environment framework-version=\"3.7.1.0\" clr-version=\"4.0.30319.42000\" os-version=\"Unix 16.7.0.0\" platform=\"Unix\" cwd=\"/Users/jay/github/dynamitey\" machine-name=\"katniss.lan\" user=\"jay\" user-domain=\"katniss.lan\" culture=\"en-US\" uiculture=\"en-US\" os-architecture=\"x64\" />\n    <settings>\n      <setting name=\"DisposeRunners\" value=\"True\" />\n      <setting name=\"WorkDirectory\" value=\"/Users/jay/github/dynamitey\" />\n      <setting name=\"ImageRuntimeVersion\" value=\"4.0.30319\" />\n      <setting name=\"ImageTargetFrameworkName\" value=\".NETFramework,Version=v4.6.2\" />\n      <setting name=\"ImageRequiresX86\" value=\"False\" />\n      <setting name=\"ImageRequiresDefaultAppDomainAssemblyResolver\" value=\"False\" />\n      <setting name=\"NumberOfTestWorkers\" value=\"4\" />\n    </settings>\n    <properties>\n      <property name=\"_PID\" value=\"14074\" />\n      <property name=\"_APPDOMAIN\" value=\"domain-\" />\n    </properties>\n    <test-suite type=\"TestSuite\" id=\"0-1225\" name=\"Dynamitey\" fullname=\"Dynamitey\" runstate=\"Runnable\" testcasecount=\"214\" result=\"Passed\" start-time=\"2017-08-18 02:58:00Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"4.051946\" total=\"182\" passed=\"182\" failed=\"0\" warnings=\"0\" inconclusive=\"0\" skipped=\"0\" asserts=\"385\">\n      <properties />\n      <test-suite type=\"TestSuite\" id=\"0-1226\" name=\"Tests\" fullname=\"Dynamitey.Tests\" runstate=\"Runnable\" testcasecount=\"214\" result=\"Passed\" start-time=\"2017-08-18 02:58:00Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"4.049176\" total=\"182\" passed=\"182\" failed=\"0\" warnings=\"0\" inconclusive=\"0\" skipped=\"0\" asserts=\"385\">\n        <properties />\n        <test-suite type=\"TestFixture\" id=\"0-1000\" name=\"Curry\" fullname=\"Dynamitey.Tests.Curry\" classname=\"Dynamitey.Tests.Curry\" runstate=\"Runnable\" testcasecount=\"23\" result=\"Passed\" start-time=\"2017-08-18 02:58:00Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.895074\" total=\"23\" passed=\"23\" failed=\"0\" warnings=\"0\" inconclusive=\"0\" skipped=\"0\" asserts=\"34\">\n          <properties />\n          <test-case id=\"0-1021\" name=\"BasicCurryTest\" fullname=\"Dynamitey.Tests.Curry.BasicCurryTest\" methodname=\"BasicCurryTest\" classname=\"Dynamitey.Tests.Curry\" runstate=\"Runnable\" seed=\"1696345105\" result=\"Passed\" start-time=\"2017-08-18 02:58:00Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.335576\" asserts=\"4\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1017\" name=\"BoundedCurryCont\" fullname=\"Dynamitey.Tests.Curry.BoundedCurryCont\" methodname=\"BoundedCurryCont\" classname=\"Dynamitey.Tests.Curry\" runstate=\"Runnable\" seed=\"490778140\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.137516\" asserts=\"3\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1022\" name=\"CurryLeftPipeTest\" fullname=\"Dynamitey.Tests.Curry.CurryLeftPipeTest\" methodname=\"CurryLeftPipeTest\" classname=\"Dynamitey.Tests.Curry\" runstate=\"Runnable\" seed=\"438963864\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.011774\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1023\" name=\"CurryRightPipeTest\" fullname=\"Dynamitey.Tests.Curry.CurryRightPipeTest\" methodname=\"CurryRightPipeTest\" classname=\"Dynamitey.Tests.Curry\" runstate=\"Runnable\" seed=\"720857294\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.009728\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1003\" name=\"TestBasicConvertDelegateCurry\" fullname=\"Dynamitey.Tests.Curry.TestBasicConvertDelegateCurry\" methodname=\"TestBasicConvertDelegateCurry\" classname=\"Dynamitey.Tests.Curry\" runstate=\"Runnable\" seed=\"403683623\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.043986\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1007\" name=\"TestBasicConvertDelegateCurryParamValueType\" fullname=\"Dynamitey.Tests.Curry.TestBasicConvertDelegateCurryParamValueType\" methodname=\"TestBasicConvertDelegateCurryParamValueType\" classname=\"Dynamitey.Tests.Curry\" runstate=\"Runnable\" seed=\"467963955\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.015106\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1004\" name=\"TestBasicConvertDelegateCurryReturnValueType\" fullname=\"Dynamitey.Tests.Curry.TestBasicConvertDelegateCurryReturnValueType\" methodname=\"TestBasicConvertDelegateCurryReturnValueType\" classname=\"Dynamitey.Tests.Curry\" runstate=\"Runnable\" seed=\"1336834135\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.006215\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1008\" name=\"TestBasicConvertMoreCurryParamValueType\" fullname=\"Dynamitey.Tests.Curry.TestBasicConvertMoreCurryParamValueType\" methodname=\"TestBasicConvertMoreCurryParamValueType\" classname=\"Dynamitey.Tests.Curry\" runstate=\"Runnable\" seed=\"2141329338\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.006889\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1009\" name=\"TestBasicConvertMoreMoreCurryParamValueType\" fullname=\"Dynamitey.Tests.Curry.TestBasicConvertMoreMoreCurryParamValueType\" methodname=\"TestBasicConvertMoreMoreCurryParamValueType\" classname=\"Dynamitey.Tests.Curry\" runstate=\"Runnable\" seed=\"1675575714\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.015954\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1005\" name=\"TestBasicConvertNonGenericDelegate\" fullname=\"Dynamitey.Tests.Curry.TestBasicConvertNonGenericDelegate\" methodname=\"TestBasicConvertNonGenericDelegate\" classname=\"Dynamitey.Tests.Curry\" runstate=\"Runnable\" seed=\"591002522\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.014075\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1006\" name=\"TestBasicConvertNonGenericDelegateAction\" fullname=\"Dynamitey.Tests.Curry.TestBasicConvertNonGenericDelegateAction\" methodname=\"TestBasicConvertNonGenericDelegateAction\" classname=\"Dynamitey.Tests.Curry\" runstate=\"Runnable\" seed=\"1617794641\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.016568\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1001\" name=\"TestBasicDelegateCurry\" fullname=\"Dynamitey.Tests.Curry.TestBasicDelegateCurry\" methodname=\"TestBasicDelegateCurry\" classname=\"Dynamitey.Tests.Curry\" runstate=\"Runnable\" seed=\"1283827233\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.005558\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1002\" name=\"TestBasicNamedCurry\" fullname=\"Dynamitey.Tests.Curry.TestBasicNamedCurry\" methodname=\"TestBasicNamedCurry\" classname=\"Dynamitey.Tests.Curry\" runstate=\"Runnable\" seed=\"136992051\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.005249\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1018\" name=\"TestCurryNamedMethods\" fullname=\"Dynamitey.Tests.Curry.TestCurryNamedMethods\" methodname=\"TestCurryNamedMethods\" classname=\"Dynamitey.Tests.Curry\" runstate=\"Runnable\" seed=\"813893259\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.011757\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1014\" name=\"TestDynamicMethodCurry\" fullname=\"Dynamitey.Tests.Curry.TestDynamicMethodCurry\" methodname=\"TestDynamicMethodCurry\" classname=\"Dynamitey.Tests.Curry\" runstate=\"Runnable\" seed=\"2067523163\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.022601\" asserts=\"2\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1010\" name=\"TestPococMethodCurry\" fullname=\"Dynamitey.Tests.Curry.TestPococMethodCurry\" methodname=\"TestPococMethodCurry\" classname=\"Dynamitey.Tests.Curry\" runstate=\"Runnable\" seed=\"1776733355\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.008254\" asserts=\"2\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1019\" name=\"TestPococMethodPartialApply\" fullname=\"Dynamitey.Tests.Curry.TestPococMethodPartialApply\" methodname=\"TestPococMethodPartialApply\" classname=\"Dynamitey.Tests.Curry\" runstate=\"Runnable\" seed=\"576146724\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.003845\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1011\" name=\"TestStaticMethodCurry\" fullname=\"Dynamitey.Tests.Curry.TestStaticMethodCurry\" methodname=\"TestStaticMethodCurry\" classname=\"Dynamitey.Tests.Curry\" runstate=\"Runnable\" seed=\"628655389\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.013858\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1012\" name=\"TestStaticMethodLongCurry\" fullname=\"Dynamitey.Tests.Curry.TestStaticMethodLongCurry\" methodname=\"TestStaticMethodLongCurry\" classname=\"Dynamitey.Tests.Curry\" runstate=\"Runnable\" seed=\"2004129468\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.061739\" asserts=\"0\">\n            <properties />\n            <output><![CDATA[2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100\n]]></output>\n          </test-case>\n          <test-case id=\"0-1013\" name=\"TestStaticMethodLongCurry2\" fullname=\"Dynamitey.Tests.Curry.TestStaticMethodLongCurry2\" methodname=\"TestStaticMethodLongCurry2\" classname=\"Dynamitey.Tests.Curry\" runstate=\"Runnable\" seed=\"1102850621\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.054528\" asserts=\"0\">\n            <properties />\n            <output><![CDATA[0123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899\n]]></output>\n          </test-case>\n          <test-case id=\"0-1015\" name=\"UnboundedCurry\" fullname=\"Dynamitey.Tests.Curry.UnboundedCurry\" methodname=\"UnboundedCurry\" classname=\"Dynamitey.Tests.Curry\" runstate=\"Runnable\" seed=\"162029370\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.007535\" asserts=\"2\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1016\" name=\"UnboundedCurryCont\" fullname=\"Dynamitey.Tests.Curry.UnboundedCurryCont\" methodname=\"UnboundedCurryCont\" classname=\"Dynamitey.Tests.Curry\" runstate=\"Runnable\" seed=\"220570920\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.008807\" asserts=\"3\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1020\" name=\"UnboundedPartialApply\" fullname=\"Dynamitey.Tests.Curry.UnboundedPartialApply\" methodname=\"UnboundedPartialApply\" classname=\"Dynamitey.Tests.Curry\" runstate=\"Runnable\" seed=\"1705341809\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.012569\" asserts=\"4\">\n            <properties />\n          </test-case>\n        </test-suite>\n        <test-suite type=\"TestFixture\" id=\"0-1024\" name=\"DynamicObjs\" fullname=\"Dynamitey.Tests.DynamicObjs\" classname=\"Dynamitey.Tests.DynamicObjs\" runstate=\"Runnable\" testcasecount=\"28\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"1.006061\" total=\"28\" passed=\"28\" failed=\"0\" warnings=\"0\" inconclusive=\"0\" skipped=\"0\" asserts=\"96\">\n          <properties />\n          <test-case id=\"0-1037\" name=\"DictionaryMethodsOutTest\" fullname=\"Dynamitey.Tests.DynamicObjs.DictionaryMethodsOutTest\" methodname=\"DictionaryMethodsOutTest\" classname=\"Dynamitey.Tests.DynamicObjs\" runstate=\"Runnable\" seed=\"1292964848\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.031527\" asserts=\"4\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1035\" name=\"DictionaryMethodsTest\" fullname=\"Dynamitey.Tests.DynamicObjs.DictionaryMethodsTest\" methodname=\"DictionaryMethodsTest\" classname=\"Dynamitey.Tests.DynamicObjs\" runstate=\"Runnable\" seed=\"1888222603\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.026906\" asserts=\"4\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1038\" name=\"DictionaryMethodsTestWithPropertyAccess\" fullname=\"Dynamitey.Tests.DynamicObjs.DictionaryMethodsTestWithPropertyAccess\" methodname=\"DictionaryMethodsTestWithPropertyAccess\" classname=\"Dynamitey.Tests.DynamicObjs\" runstate=\"Runnable\" seed=\"825779862\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.018852\" asserts=\"3\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1039\" name=\"DictionaryNullMethodsTest\" fullname=\"Dynamitey.Tests.DynamicObjs.DictionaryNullMethodsTest\" methodname=\"DictionaryNullMethodsTest\" classname=\"Dynamitey.Tests.DynamicObjs\" runstate=\"Runnable\" seed=\"1223670623\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.006197\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1043\" name=\"DynamicAnnonymousWrapper\" fullname=\"Dynamitey.Tests.DynamicObjs.DynamicAnnonymousWrapper\" methodname=\"DynamicAnnonymousWrapper\" classname=\"Dynamitey.Tests.DynamicObjs\" runstate=\"Runnable\" seed=\"449885773\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.030546\" asserts=\"6\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1040\" name=\"DynamicDictionaryWrappedTest\" fullname=\"Dynamitey.Tests.DynamicObjs.DynamicDictionaryWrappedTest\" methodname=\"DynamicDictionaryWrappedTest\" classname=\"Dynamitey.Tests.DynamicObjs\" runstate=\"Runnable\" seed=\"1198858309\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.011271\" asserts=\"4\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1042\" name=\"DynamicObjectEqualsTest\" fullname=\"Dynamitey.Tests.DynamicObjs.DynamicObjectEqualsTest\" methodname=\"DynamicObjectEqualsTest\" classname=\"Dynamitey.Tests.DynamicObjs\" runstate=\"Runnable\" seed=\"1545402529\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.009657\" asserts=\"3\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1031\" name=\"ForwardAnonTest\" fullname=\"Dynamitey.Tests.DynamicObjs.ForwardAnonTest\" methodname=\"ForwardAnonTest\" classname=\"Dynamitey.Tests.DynamicObjs\" runstate=\"Runnable\" seed=\"2006528908\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.016044\" asserts=\"3\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1034\" name=\"ForwardDynamicTest\" fullname=\"Dynamitey.Tests.DynamicObjs.ForwardDynamicTest\" methodname=\"ForwardDynamicTest\" classname=\"Dynamitey.Tests.DynamicObjs\" runstate=\"Runnable\" seed=\"1229209861\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.028410\" asserts=\"3\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1033\" name=\"ForwardGenericMethodsTest\" fullname=\"Dynamitey.Tests.DynamicObjs.ForwardGenericMethodsTest\" methodname=\"ForwardGenericMethodsTest\" classname=\"Dynamitey.Tests.DynamicObjs\" runstate=\"Runnable\" seed=\"1691511659\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.006713\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1036\" name=\"ForwardMethodsTest\" fullname=\"Dynamitey.Tests.DynamicObjs.ForwardMethodsTest\" methodname=\"ForwardMethodsTest\" classname=\"Dynamitey.Tests.DynamicObjs\" runstate=\"Runnable\" seed=\"236784144\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.020247\" asserts=\"4\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1032\" name=\"ForwardVoidTest\" fullname=\"Dynamitey.Tests.DynamicObjs.ForwardVoidTest\" methodname=\"ForwardVoidTest\" classname=\"Dynamitey.Tests.DynamicObjs\" runstate=\"Runnable\" seed=\"1991725161\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.003618\" asserts=\"0\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1025\" name=\"GetterAnonTest\" fullname=\"Dynamitey.Tests.DynamicObjs.GetterAnonTest\" methodname=\"GetterAnonTest\" classname=\"Dynamitey.Tests.DynamicObjs\" runstate=\"Runnable\" seed=\"864013086\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.009711\" asserts=\"3\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1027\" name=\"GetterArrayTest\" fullname=\"Dynamitey.Tests.DynamicObjs.GetterArrayTest\" methodname=\"GetterArrayTest\" classname=\"Dynamitey.Tests.DynamicObjs\" runstate=\"Runnable\" seed=\"349490125\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.024691\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1030\" name=\"GetterDynamicTest\" fullname=\"Dynamitey.Tests.DynamicObjs.GetterDynamicTest\" methodname=\"GetterDynamicTest\" classname=\"Dynamitey.Tests.DynamicObjs\" runstate=\"Runnable\" seed=\"977266072\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.019628\" asserts=\"3\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1028\" name=\"GetterEventTest\" fullname=\"Dynamitey.Tests.DynamicObjs.GetterEventTest\" methodname=\"GetterEventTest\" classname=\"Dynamitey.Tests.DynamicObjs\" runstate=\"Runnable\" seed=\"424854619\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.026883\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1029\" name=\"GetterEventTest2\" fullname=\"Dynamitey.Tests.DynamicObjs.GetterEventTest2\" methodname=\"GetterEventTest2\" classname=\"Dynamitey.Tests.DynamicObjs\" runstate=\"Runnable\" seed=\"668697137\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.011233\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1026\" name=\"GetterVoidTest\" fullname=\"Dynamitey.Tests.DynamicObjs.GetterVoidTest\" methodname=\"GetterVoidTest\" classname=\"Dynamitey.Tests.DynamicObjs\" runstate=\"Runnable\" seed=\"588266588\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.001846\" asserts=\"0\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1041\" name=\"InterfaceDictionaryWrappedTest\" fullname=\"Dynamitey.Tests.DynamicObjs.InterfaceDictionaryWrappedTest\" methodname=\"InterfaceDictionaryWrappedTest\" classname=\"Dynamitey.Tests.DynamicObjs\" runstate=\"Runnable\" seed=\"1729828016\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:01Z\" duration=\"0.055831\" asserts=\"13\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1044\" name=\"TestAnonInterface\" fullname=\"Dynamitey.Tests.DynamicObjs.TestAnonInterface\" methodname=\"TestAnonInterface\" classname=\"Dynamitey.Tests.DynamicObjs\" runstate=\"Runnable\" seed=\"1430094309\" result=\"Passed\" start-time=\"2017-08-18 02:58:01Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.051542\" asserts=\"4\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1045\" name=\"TestBuilder\" fullname=\"Dynamitey.Tests.DynamicObjs.TestBuilder\" methodname=\"TestBuilder\" classname=\"Dynamitey.Tests.DynamicObjs\" runstate=\"Runnable\" seed=\"915337007\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.022035\" asserts=\"4\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1047\" name=\"TestClayFactorySyntax\" fullname=\"Dynamitey.Tests.DynamicObjs.TestClayFactorySyntax\" methodname=\"TestClayFactorySyntax\" classname=\"Dynamitey.Tests.DynamicObjs\" runstate=\"Runnable\" seed=\"2008779707\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.068823\" asserts=\"11\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1051\" name=\"TestCodeDomLateTypeBind\" fullname=\"Dynamitey.Tests.DynamicObjs.TestCodeDomLateTypeBind\" methodname=\"TestCodeDomLateTypeBind\" classname=\"Dynamitey.Tests.DynamicObjs\" runstate=\"Runnable\" seed=\"1274599281\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.296100\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1048\" name=\"TestFactoryListSyntax\" fullname=\"Dynamitey.Tests.DynamicObjs.TestFactoryListSyntax\" methodname=\"TestFactoryListSyntax\" classname=\"Dynamitey.Tests.DynamicObjs\" runstate=\"Runnable\" seed=\"1891181677\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.025996\" asserts=\"4\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1052\" name=\"TestLateLibrarybind\" fullname=\"Dynamitey.Tests.DynamicObjs.TestLateLibrarybind\" methodname=\"TestLateLibrarybind\" classname=\"Dynamitey.Tests.DynamicObjs\" runstate=\"Runnable\" seed=\"318651645\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.043592\" asserts=\"3\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1049\" name=\"TestQuicListSyntax\" fullname=\"Dynamitey.Tests.DynamicObjs.TestQuicListSyntax\" methodname=\"TestQuicListSyntax\" classname=\"Dynamitey.Tests.DynamicObjs\" runstate=\"Runnable\" seed=\"848127100\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.017475\" asserts=\"2\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1050\" name=\"TestRecorder\" fullname=\"Dynamitey.Tests.DynamicObjs.TestRecorder\" methodname=\"TestRecorder\" classname=\"Dynamitey.Tests.DynamicObjs\" runstate=\"Runnable\" seed=\"820369284\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.023505\" asserts=\"3\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1046\" name=\"TestSetupOtherTypes\" fullname=\"Dynamitey.Tests.DynamicObjs.TestSetupOtherTypes\" methodname=\"TestSetupOtherTypes\" classname=\"Dynamitey.Tests.DynamicObjs\" runstate=\"Runnable\" seed=\"642822706\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.028195\" asserts=\"6\">\n            <properties />\n          </test-case>\n        </test-suite>\n        <test-suite type=\"TestFixture\" id=\"0-1053\" name=\"ExpandoObjs\" fullname=\"Dynamitey.Tests.ExpandoObjs\" classname=\"Dynamitey.Tests.ExpandoObjs\" runstate=\"Runnable\" testcasecount=\"2\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.039595\" total=\"2\" passed=\"2\" failed=\"0\" warnings=\"0\" inconclusive=\"0\" skipped=\"0\" asserts=\"10\">\n          <properties />\n          <test-case id=\"0-1054\" name=\"TestExpando\" fullname=\"Dynamitey.Tests.ExpandoObjs.TestExpando\" methodname=\"TestExpando\" classname=\"Dynamitey.Tests.ExpandoObjs\" runstate=\"Runnable\" seed=\"335812586\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.016095\" asserts=\"5\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1055\" name=\"TestExpando2\" fullname=\"Dynamitey.Tests.ExpandoObjs.TestExpando2\" methodname=\"TestExpando2\" classname=\"Dynamitey.Tests.ExpandoObjs\" runstate=\"Runnable\" seed=\"473210877\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.018184\" asserts=\"5\">\n            <properties />\n          </test-case>\n        </test-suite>\n        <test-suite type=\"TestFixture\" id=\"0-1056\" name=\"Impromptu\" fullname=\"Dynamitey.Tests.Impromptu\" classname=\"Dynamitey.Tests.Impromptu\" runstate=\"Runnable\" testcasecount=\"4\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.110832\" total=\"4\" passed=\"4\" failed=\"0\" warnings=\"0\" inconclusive=\"0\" skipped=\"0\" asserts=\"6\">\n          <properties>\n            <property name=\"Category\" value=\"Impromptu\" />\n          </properties>\n          <test-case id=\"0-1058\" name=\"DictionaryCurriedAcctlikeNullMethodsTest\" fullname=\"Dynamitey.Tests.Impromptu.DictionaryCurriedAcctlikeNullMethodsTest\" methodname=\"DictionaryCurriedAcctlikeNullMethodsTest\" classname=\"Dynamitey.Tests.Impromptu\" runstate=\"Runnable\" seed=\"937155176\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.051798\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1057\" name=\"DictionaryInterfaceNullMethodsTest\" fullname=\"Dynamitey.Tests.Impromptu.DictionaryInterfaceNullMethodsTest\" methodname=\"DictionaryInterfaceNullMethodsTest\" classname=\"Dynamitey.Tests.Impromptu\" runstate=\"Runnable\" seed=\"1256018280\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.002701\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1059\" name=\"TestBuilderActLikeAnon\" fullname=\"Dynamitey.Tests.Impromptu.TestBuilderActLikeAnon\" methodname=\"TestBuilderActLikeAnon\" classname=\"Dynamitey.Tests.Impromptu\" runstate=\"Runnable\" seed=\"575371779\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.040859\" asserts=\"2\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1060\" name=\"TestBuilderActLikeNamed\" fullname=\"Dynamitey.Tests.Impromptu.TestBuilderActLikeNamed\" methodname=\"TestBuilderActLikeNamed\" classname=\"Dynamitey.Tests.Impromptu\" runstate=\"Runnable\" seed=\"443490820\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.004847\" asserts=\"2\">\n            <properties />\n          </test-case>\n        </test-suite>\n        <test-suite type=\"TestFixture\" id=\"0-1061\" name=\"Invoke\" fullname=\"Dynamitey.Tests.Invoke\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" testcasecount=\"86\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.879445\" total=\"86\" passed=\"86\" failed=\"0\" warnings=\"0\" inconclusive=\"0\" skipped=\"0\" asserts=\"171\">\n          <properties />\n          <test-case id=\"0-1069\" name=\"TestCacheableConstruct\" fullname=\"Dynamitey.Tests.Invoke.TestCacheableConstruct\" methodname=\"TestCacheableConstruct\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1275937143\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.007051\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1071\" name=\"TestCacheableConstructOptional\" fullname=\"Dynamitey.Tests.Invoke.TestCacheableConstructOptional\" methodname=\"TestCacheableConstructOptional\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1323043406\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.001594\" asserts=\"3\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1074\" name=\"TestCacheableConstructValueType\" fullname=\"Dynamitey.Tests.Invoke.TestCacheableConstructValueType\" methodname=\"TestCacheableConstructValueType\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"764162622\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.014391\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1065\" name=\"TestCacheableDyanmicSetAndPocoSetAndSetNull\" fullname=\"Dynamitey.Tests.Invoke.TestCacheableDyanmicSetAndPocoSetAndSetNull\" methodname=\"TestCacheableDyanmicSetAndPocoSetAndSetNull\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"2058388683\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.004517\" asserts=\"3\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1139\" name=\"TestCacheableDynamicAddAssign\" fullname=\"Dynamitey.Tests.Invoke.TestCacheableDynamicAddAssign\" methodname=\"TestCacheableDynamicAddAssign\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"2139603772\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.026341\" asserts=\"2\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1141\" name=\"TestCacheableDynamicSubtractAssign\" fullname=\"Dynamitey.Tests.Invoke.TestCacheableDynamicSubtractAssign\" methodname=\"TestCacheableDynamicSubtractAssign\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"965762150\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.020962\" asserts=\"2\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1089\" name=\"TestCacheableGet\" fullname=\"Dynamitey.Tests.Invoke.TestCacheableGet\" methodname=\"TestCacheableGet\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"457205339\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.001017\" asserts=\"2\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1122\" name=\"TestCacheableGetDynamic\" fullname=\"Dynamitey.Tests.Invoke.TestCacheableGetDynamic\" methodname=\"TestCacheableGetDynamic\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"2145013977\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.002578\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1088\" name=\"TestCacheableImplicitConvert\" fullname=\"Dynamitey.Tests.Invoke.TestCacheableImplicitConvert\" methodname=\"TestCacheableImplicitConvert\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1111963497\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.006213\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1094\" name=\"TestCacheableIndexer\" fullname=\"Dynamitey.Tests.Invoke.TestCacheableIndexer\" methodname=\"TestCacheableIndexer\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"690033843\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.002648\" asserts=\"6\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1132\" name=\"TestCacheableIsEventAndIsNotEvent\" fullname=\"Dynamitey.Tests.Invoke.TestCacheableIsEventAndIsNotEvent\" methodname=\"TestCacheableIsEventAndIsNotEvent\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1895178688\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.002233\" asserts=\"2\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1098\" name=\"TestCacheableMethodDynamicPassAndGetValue\" fullname=\"Dynamitey.Tests.Invoke.TestCacheableMethodDynamicPassAndGetValue\" methodname=\"TestCacheableMethodDynamicPassAndGetValue\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1983119105\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.003865\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1108\" name=\"TestCacheableMethodDynamicPassVoid\" fullname=\"Dynamitey.Tests.Invoke.TestCacheableMethodDynamicPassVoid\" methodname=\"TestCacheableMethodDynamicPassVoid\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"685824872\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.003650\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1109\" name=\"TestCacheableMethodDynamicUnknowns\" fullname=\"Dynamitey.Tests.Invoke.TestCacheableMethodDynamicUnknowns\" methodname=\"TestCacheableMethodDynamicUnknowns\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"2005095868\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.008879\" asserts=\"2\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1103\" name=\"TestCacheableMethodPocoOverloadingPassAndGetValueArgOptional\" fullname=\"Dynamitey.Tests.Invoke.TestCacheableMethodPocoOverloadingPassAndGetValueArgOptional\" methodname=\"TestCacheableMethodPocoOverloadingPassAndGetValueArgOptional\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"2008021831\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.001656\" asserts=\"2\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1135\" name=\"TestCacheablePocoAddAssign\" fullname=\"Dynamitey.Tests.Invoke.TestCacheablePocoAddAssign\" methodname=\"TestCacheablePocoAddAssign\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"305010396\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.003187\" asserts=\"2\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1137\" name=\"TestCacheablePocoSubtractAssign\" fullname=\"Dynamitey.Tests.Invoke.TestCacheablePocoSubtractAssign\" methodname=\"TestCacheablePocoSubtractAssign\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"977312271\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.003000\" asserts=\"2\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1081\" name=\"TestCacheablePrimativeDateTimeObjectNullableAndGuidNoParams\" fullname=\"Dynamitey.Tests.Invoke.TestCacheablePrimativeDateTimeObjectNullableAndGuidNoParams\" methodname=\"TestCacheablePrimativeDateTimeObjectNullableAndGuidNoParams\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"960259669\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.015758\" asserts=\"6\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1096\" name=\"TestCacheableSetIndexer\" fullname=\"Dynamitey.Tests.Invoke.TestCacheableSetIndexer\" methodname=\"TestCacheableSetIndexer\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1295837946\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.005758\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1083\" name=\"TestCacheableStaticCall\" fullname=\"Dynamitey.Tests.Invoke.TestCacheableStaticCall\" methodname=\"TestCacheableStaticCall\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1754830170\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.001483\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1130\" name=\"TestCacheableStaticDateTimeMethod\" fullname=\"Dynamitey.Tests.Invoke.TestCacheableStaticDateTimeMethod\" methodname=\"TestCacheableStaticDateTimeMethod\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1673396321\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.020716\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1124\" name=\"TestCacheableStaticGet\" fullname=\"Dynamitey.Tests.Invoke.TestCacheableStaticGet\" methodname=\"TestCacheableStaticGet\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1151963529\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.017034\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1128\" name=\"TestCacheableStaticSet\" fullname=\"Dynamitey.Tests.Invoke.TestCacheableStaticSet\" methodname=\"TestCacheableStaticSet\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"450296842\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.001647\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1100\" name=\"TestCachedMethodStaticOverloadingPassAndGetValue\" fullname=\"Dynamitey.Tests.Invoke.TestCachedMethodStaticOverloadingPassAndGetValue\" methodname=\"TestCachedMethodStaticOverloadingPassAndGetValue\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"786951351\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:02Z\" duration=\"0.002880\" asserts=\"4\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1086\" name=\"TestCoerceConverterColor\" fullname=\"Dynamitey.Tests.Invoke.TestCoerceConverterColor\" methodname=\"TestCoerceConverterColor\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1909097723\" result=\"Passed\" start-time=\"2017-08-18 02:58:02Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.096473\" asserts=\"2\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1087\" name=\"TestCoerceConverterDBNULL\" fullname=\"Dynamitey.Tests.Invoke.TestCoerceConverterDBNULL\" methodname=\"TestCoerceConverterDBNULL\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"249342895\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.006519\" asserts=\"3\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1068\" name=\"TestConstruct\" fullname=\"Dynamitey.Tests.Invoke.TestConstruct\" methodname=\"TestConstruct\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"708882738\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.002479\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1077\" name=\"TestConstructDateTimeNoParams\" fullname=\"Dynamitey.Tests.Invoke.TestConstructDateTimeNoParams\" methodname=\"TestConstructDateTimeNoParams\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1092235480\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.001775\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1080\" name=\"TestConstructGuid\" fullname=\"Dynamitey.Tests.Invoke.TestConstructGuid\" methodname=\"TestConstructGuid\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1363650507\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.001741\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1079\" name=\"TestConstructNullableprimativetype\" fullname=\"Dynamitey.Tests.Invoke.TestConstructNullableprimativetype\" methodname=\"TestConstructNullableprimativetype\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1922141263\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.001568\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1078\" name=\"TestConstructOBjectNoParams\" fullname=\"Dynamitey.Tests.Invoke.TestConstructOBjectNoParams\" methodname=\"TestConstructOBjectNoParams\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1075159224\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.002754\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1070\" name=\"TestConstructOptional\" fullname=\"Dynamitey.Tests.Invoke.TestConstructOptional\" methodname=\"TestConstructOptional\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1155778069\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.001968\" asserts=\"3\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1076\" name=\"TestConstructprimativetype\" fullname=\"Dynamitey.Tests.Invoke.TestConstructprimativetype\" methodname=\"TestConstructprimativetype\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1481837191\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.001700\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1073\" name=\"TestConstructValueType\" fullname=\"Dynamitey.Tests.Invoke.TestConstructValueType\" methodname=\"TestConstructValueType\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"2131422172\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.003548\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1075\" name=\"TestConstructValueTypeJustDynamic\" fullname=\"Dynamitey.Tests.Invoke.TestConstructValueTypeJustDynamic\" methodname=\"TestConstructValueTypeJustDynamic\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"874755041\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.001583\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1066\" name=\"TestConvert\" fullname=\"Dynamitey.Tests.Invoke.TestConvert\" methodname=\"TestConvert\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1465345550\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.018326\" asserts=\"2\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1067\" name=\"TestConvertCacheable\" fullname=\"Dynamitey.Tests.Invoke.TestConvertCacheable\" methodname=\"TestConvertCacheable\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1683682853\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.001457\" asserts=\"2\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1138\" name=\"TestDynamicAddAssign\" fullname=\"Dynamitey.Tests.Invoke.TestDynamicAddAssign\" methodname=\"TestDynamicAddAssign\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"2052694187\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.015911\" asserts=\"2\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1142\" name=\"TestDynamicMemberNamesExpando\" fullname=\"Dynamitey.Tests.Invoke.TestDynamicMemberNamesExpando\" methodname=\"TestDynamicMemberNamesExpando\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1598081148\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.009097\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1143\" name=\"TestDynamicMemberNamesImpromput\" fullname=\"Dynamitey.Tests.Invoke.TestDynamicMemberNamesImpromput\" methodname=\"TestDynamicMemberNamesImpromput\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"2086724996\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.003587\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1062\" name=\"TestDynamicSet\" fullname=\"Dynamitey.Tests.Invoke.TestDynamicSet\" methodname=\"TestDynamicSet\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"460840371\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.003779\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1140\" name=\"TestDynamicSubtractAssign\" fullname=\"Dynamitey.Tests.Invoke.TestDynamicSubtractAssign\" methodname=\"TestDynamicSubtractAssign\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1796415730\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.012125\" asserts=\"2\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1112\" name=\"TestGetDynamic\" fullname=\"Dynamitey.Tests.Invoke.TestGetDynamic\" methodname=\"TestGetDynamic\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1862201887\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.005503\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1113\" name=\"TestGetDynamicChained\" fullname=\"Dynamitey.Tests.Invoke.TestGetDynamicChained\" methodname=\"TestGetDynamicChained\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"87913980\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.015709\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1121\" name=\"TestGetDynamicChainedOne\" fullname=\"Dynamitey.Tests.Invoke.TestGetDynamicChainedOne\" methodname=\"TestGetDynamicChainedOne\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"973217138\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.003238\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1114\" name=\"TestGetDynamicChainedWithIndexes\" fullname=\"Dynamitey.Tests.Invoke.TestGetDynamicChainedWithIndexes\" methodname=\"TestGetDynamicChainedWithIndexes\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1133058740\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.033138\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1090\" name=\"TestGetIndexer\" fullname=\"Dynamitey.Tests.Invoke.TestGetIndexer\" methodname=\"TestGetIndexer\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"230892949\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.003145\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1093\" name=\"TestGetIndexerArray\" fullname=\"Dynamitey.Tests.Invoke.TestGetIndexerArray\" methodname=\"TestGetIndexerArray\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1088253778\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.004612\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1091\" name=\"TestGetIndexerValue\" fullname=\"Dynamitey.Tests.Invoke.TestGetIndexerValue\" methodname=\"TestGetIndexerValue\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1948355804\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.001013\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1092\" name=\"TestGetLengthArray\" fullname=\"Dynamitey.Tests.Invoke.TestGetLengthArray\" methodname=\"TestGetLengthArray\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"398251523\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.001843\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1085\" name=\"TestImplicitConvert\" fullname=\"Dynamitey.Tests.Invoke.TestImplicitConvert\" methodname=\"TestImplicitConvert\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1275420256\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.002882\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1144\" name=\"TestInvokeAdd\" fullname=\"Dynamitey.Tests.Invoke.TestInvokeAdd\" methodname=\"TestInvokeAdd\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1879403412\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.005444\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1146\" name=\"TestInvokeBasicBinaryOperatorsDynamic\" fullname=\"Dynamitey.Tests.Invoke.TestInvokeBasicBinaryOperatorsDynamic\" methodname=\"TestInvokeBasicBinaryOperatorsDynamic\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1819216783\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.021298\" asserts=\"20\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1145\" name=\"TestInvokeBasicUnaryOperatorsDynamic\" fullname=\"Dynamitey.Tests.Invoke.TestInvokeBasicUnaryOperatorsDynamic\" methodname=\"TestInvokeBasicUnaryOperatorsDynamic\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"902067639\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.008393\" asserts=\"4\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1147\" name=\"TestInvokeSubtract\" fullname=\"Dynamitey.Tests.Invoke.TestInvokeSubtract\" methodname=\"TestInvokeSubtract\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1457275360\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.002178\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1131\" name=\"TestIsEvent\" fullname=\"Dynamitey.Tests.Invoke.TestIsEvent\" methodname=\"TestIsEvent\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"504718496\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.002916\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1133\" name=\"TestIsNotEvent\" fullname=\"Dynamitey.Tests.Invoke.TestIsNotEvent\" methodname=\"TestIsNotEvent\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"827007549\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.012631\" asserts=\"5\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1097\" name=\"TestMethodDynamicPassAndGetValue\" fullname=\"Dynamitey.Tests.Invoke.TestMethodDynamicPassAndGetValue\" methodname=\"TestMethodDynamicPassAndGetValue\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1664443988\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.007976\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1107\" name=\"TestMethodDynamicPassVoid\" fullname=\"Dynamitey.Tests.Invoke.TestMethodDynamicPassVoid\" methodname=\"TestMethodDynamicPassVoid\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1011735166\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.003852\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1110\" name=\"TestMethodPocoGetValue\" fullname=\"Dynamitey.Tests.Invoke.TestMethodPocoGetValue\" methodname=\"TestMethodPocoGetValue\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"2092967095\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.002718\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1104\" name=\"TestMethodPocoOverloadingPass2AndGetValueArgOptional\" fullname=\"Dynamitey.Tests.Invoke.TestMethodPocoOverloadingPass2AndGetValueArgOptional\" methodname=\"TestMethodPocoOverloadingPass2AndGetValueArgOptional\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1163796258\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.002585\" asserts=\"2\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1101\" name=\"TestMethodPocoOverloadingPassAndGetValueArg\" fullname=\"Dynamitey.Tests.Invoke.TestMethodPocoOverloadingPassAndGetValueArg\" methodname=\"TestMethodPocoOverloadingPassAndGetValueArg\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"688066667\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.008142\" asserts=\"4\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1102\" name=\"TestMethodPocoOverloadingPassAndGetValueArgOptional\" fullname=\"Dynamitey.Tests.Invoke.TestMethodPocoOverloadingPassAndGetValueArgOptional\" methodname=\"TestMethodPocoOverloadingPassAndGetValueArgOptional\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"754019248\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.002431\" asserts=\"2\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1105\" name=\"TestMethodPocoOverloadingPassAndGetValueNull\" fullname=\"Dynamitey.Tests.Invoke.TestMethodPocoOverloadingPassAndGetValueNull\" methodname=\"TestMethodPocoOverloadingPassAndGetValueNull\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1191707614\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.014661\" asserts=\"6\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1111\" name=\"TestMethodPocoPassAndGetValue\" fullname=\"Dynamitey.Tests.Invoke.TestMethodPocoPassAndGetValue\" methodname=\"TestMethodPocoPassAndGetValue\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1182789454\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.004518\" asserts=\"2\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1099\" name=\"TestMethodStaticOverloadingPassAndGetValue\" fullname=\"Dynamitey.Tests.Invoke.TestMethodStaticOverloadingPassAndGetValue\" methodname=\"TestMethodStaticOverloadingPassAndGetValue\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"335841650\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.004884\" asserts=\"4\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1072\" name=\"TestOptionalArgumentActivationNoneAndCacheable\" fullname=\"Dynamitey.Tests.Invoke.TestOptionalArgumentActivationNoneAndCacheable\" methodname=\"TestOptionalArgumentActivationNoneAndCacheable\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"806795175\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.004912\" asserts=\"3\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1106\" name=\"TestOutMethod\" fullname=\"Dynamitey.Tests.Invoke.TestOutMethod\" methodname=\"TestOutMethod\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1838703612\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.007339\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1134\" name=\"TestPocoAddAssign\" fullname=\"Dynamitey.Tests.Invoke.TestPocoAddAssign\" methodname=\"TestPocoAddAssign\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"116821860\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.002808\" asserts=\"2\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1063\" name=\"TestPocoSet\" fullname=\"Dynamitey.Tests.Invoke.TestPocoSet\" methodname=\"TestPocoSet\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"300678335\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.000992\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1136\" name=\"TestPocoSubtractAssign\" fullname=\"Dynamitey.Tests.Invoke.TestPocoSubtractAssign\" methodname=\"TestPocoSubtractAssign\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1245959699\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.002238\" asserts=\"2\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1118\" name=\"TestSetDynamicAllAnonymous\" fullname=\"Dynamitey.Tests.Invoke.TestSetDynamicAllAnonymous\" methodname=\"TestSetDynamicAllAnonymous\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"294486906\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.011261\" asserts=\"3\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1117\" name=\"TestSetDynamicAllDict\" fullname=\"Dynamitey.Tests.Invoke.TestSetDynamicAllDict\" methodname=\"TestSetDynamicAllDict\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1117660865\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.020467\" asserts=\"3\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1119\" name=\"TestSetDynamicAllNamed\" fullname=\"Dynamitey.Tests.Invoke.TestSetDynamicAllNamed\" methodname=\"TestSetDynamicAllNamed\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1901852669\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.009342\" asserts=\"3\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1115\" name=\"TestSetDynamicChained\" fullname=\"Dynamitey.Tests.Invoke.TestSetDynamicChained\" methodname=\"TestSetDynamicChained\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"571571906\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.007263\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1120\" name=\"TestSetDynamicChainedOne\" fullname=\"Dynamitey.Tests.Invoke.TestSetDynamicChainedOne\" methodname=\"TestSetDynamicChainedOne\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1413268435\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.003507\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1116\" name=\"TestSetDynamicChainedWithInexes\" fullname=\"Dynamitey.Tests.Invoke.TestSetDynamicChainedWithInexes\" methodname=\"TestSetDynamicChainedWithInexes\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"2107081468\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.023612\" asserts=\"2\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1095\" name=\"TestSetIndexer\" fullname=\"Dynamitey.Tests.Invoke.TestSetIndexer\" methodname=\"TestSetIndexer\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"2101265618\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.005603\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1082\" name=\"TestStaticCall\" fullname=\"Dynamitey.Tests.Invoke.TestStaticCall\" methodname=\"TestStaticCall\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"379760909\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.001890\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1129\" name=\"TestStaticDateTimeMethod\" fullname=\"Dynamitey.Tests.Invoke.TestStaticDateTimeMethod\" methodname=\"TestStaticDateTimeMethod\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"565588657\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.001925\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1123\" name=\"TestStaticGet\" fullname=\"Dynamitey.Tests.Invoke.TestStaticGet\" methodname=\"TestStaticGet\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1168048740\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.002480\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1125\" name=\"TestStaticGet2\" fullname=\"Dynamitey.Tests.Invoke.TestStaticGet2\" methodname=\"TestStaticGet2\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1281553644\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.003874\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1126\" name=\"TestStaticGet3\" fullname=\"Dynamitey.Tests.Invoke.TestStaticGet3\" methodname=\"TestStaticGet3\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"100263873\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.001702\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1084\" name=\"TestStaticPropertySetFollowedByGetTest\" fullname=\"Dynamitey.Tests.Invoke.TestStaticPropertySetFollowedByGetTest\" methodname=\"TestStaticPropertySetFollowedByGetTest\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"247100471\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.004843\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1127\" name=\"TestStaticSet\" fullname=\"Dynamitey.Tests.Invoke.TestStaticSet\" methodname=\"TestStaticSet\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"789839009\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.000296\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1064\" name=\"TestStructSet\" fullname=\"Dynamitey.Tests.Invoke.TestStructSet\" methodname=\"TestStructSet\" classname=\"Dynamitey.Tests.Invoke\" runstate=\"Runnable\" seed=\"1862284824\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.001369\" asserts=\"1\">\n            <properties />\n          </test-case>\n        </test-suite>\n        <test-suite type=\"TestFixture\" id=\"0-1148\" name=\"Linq\" fullname=\"Dynamitey.Tests.Linq\" classname=\"Dynamitey.Tests.Linq\" runstate=\"Runnable\" testcasecount=\"5\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.748008\" total=\"5\" passed=\"5\" failed=\"0\" warnings=\"0\" inconclusive=\"0\" skipped=\"0\" asserts=\"4\">\n          <properties />\n          <test-case id=\"0-1150\" name=\"MoreGenericsDynamicLinq\" fullname=\"Dynamitey.Tests.Linq.MoreGenericsDynamicLinq\" methodname=\"MoreGenericsDynamicLinq\" classname=\"Dynamitey.Tests.Linq\" runstate=\"Runnable\" seed=\"2006370602\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.057933\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1153\" name=\"PrintOutInterface\" fullname=\"Dynamitey.Tests.Linq.PrintOutInterface\" methodname=\"PrintOutInterface\" classname=\"Dynamitey.Tests.Linq\" runstate=\"Runnable\" seed=\"644567036\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:03Z\" duration=\"0.014323\" asserts=\"0\">\n            <properties />\n            <output><![CDATA[public interface ILinq<TSource>:IEnumerable<TSource>\n{\n\tTSource Aggregate(Func<TSource,TSource,TSource> func);\n\tTAccumulate Aggregate<TAccumulate>(TAccumulate seed,Func<TAccumulate,TSource,TAccumulate> func);\n\tTResult Aggregate<TAccumulate,TResult>(TAccumulate seed,Func<TAccumulate,TSource,TAccumulate> func,Func<TAccumulate,TResult> resultSelector);\n\tBoolean All(Func<TSource,Boolean> predicate);\n\tBoolean Any();\n\tBoolean Any(Func<TSource,Boolean> predicate);\n\tILinq<TSource> Append(TSource element);\n\tILinq<TSource> AsEnumerable();\n\tDouble Average(Func<TSource,Int32> selector);\n\tNullable<Double> Average(Func<TSource,Nullable<Int32>> selector);\n\tDouble Average(Func<TSource,Int64> selector);\n\tNullable<Double> Average(Func<TSource,Nullable<Int64>> selector);\n\tSingle Average(Func<TSource,Single> selector);\n\tNullable<Single> Average(Func<TSource,Nullable<Single>> selector);\n\tDouble Average(Func<TSource,Double> selector);\n\tNullable<Double> Average(Func<TSource,Nullable<Double>> selector);\n\tDecimal Average(Func<TSource,Decimal> selector);\n\tNullable<Decimal> Average(Func<TSource,Nullable<Decimal>> selector);\n\tILinq<TResult> Cast<TResult>();\n\tILinq<TSource> Concat(IEnumerable<TSource> second);\n\tBoolean Contains(TSource value);\n\tBoolean Contains(TSource value,IEqualityComparer<TSource> comparer);\n\tInt32 Count();\n\tInt32 Count(Func<TSource,Boolean> predicate);\n\tILinq<TSource> DefaultIfEmpty();\n\tILinq<TSource> DefaultIfEmpty(TSource defaultValue);\n\tILinq<TSource> Distinct();\n\tILinq<TSource> Distinct(IEqualityComparer<TSource> comparer);\n\tTSource ElementAt(Int32 index);\n\tTSource ElementAtOrDefault(Int32 index);\n\tILinq<TSource> Except(IEnumerable<TSource> second);\n\tILinq<TSource> Except(IEnumerable<TSource> second,IEqualityComparer<TSource> comparer);\n\tTSource First();\n\tTSource First(Func<TSource,Boolean> predicate);\n\tTSource FirstOrDefault();\n\tTSource FirstOrDefault(Func<TSource,Boolean> predicate);\n\tILinq<IGrouping<TKey,TSource>> GroupBy<TKey>(Func<TSource,TKey> keySelector);\n\tILinq<IGrouping<TKey,TSource>> GroupBy<TKey>(Func<TSource,TKey> keySelector,IEqualityComparer<TKey> comparer);\n\tILinq<IGrouping<TKey,TElement>> GroupBy<TKey,TElement>(Func<TSource,TKey> keySelector,Func<TSource,TElement> elementSelector);\n\tILinq<IGrouping<TKey,TElement>> GroupBy<TKey,TElement>(Func<TSource,TKey> keySelector,Func<TSource,TElement> elementSelector,IEqualityComparer<TKey> comparer);\n\tILinq<TResult> GroupBy<TKey,TResult>(Func<TSource,TKey> keySelector,Func<TKey,IEnumerable<TSource>,TResult> resultSelector);\n\tILinq<TResult> GroupBy<TKey,TElement,TResult>(Func<TSource,TKey> keySelector,Func<TSource,TElement> elementSelector,Func<TKey,IEnumerable<TElement>,TResult> resultSelector);\n\tILinq<TResult> GroupBy<TKey,TResult>(Func<TSource,TKey> keySelector,Func<TKey,IEnumerable<TSource>,TResult> resultSelector,IEqualityComparer<TKey> comparer);\n\tILinq<TResult> GroupBy<TKey,TElement,TResult>(Func<TSource,TKey> keySelector,Func<TSource,TElement> elementSelector,Func<TKey,IEnumerable<TElement>,TResult> resultSelector,IEqualityComparer<TKey> comparer);\n\tILinq<TResult> GroupJoin<TInner,TKey,TResult>(IEnumerable<TInner> inner,Func<TSource,TKey> outerKeySelector,Func<TInner,TKey> innerKeySelector,Func<TSource,IEnumerable<TInner>,TResult> resultSelector);\n\tILinq<TResult> GroupJoin<TInner,TKey,TResult>(IEnumerable<TInner> inner,Func<TSource,TKey> outerKeySelector,Func<TInner,TKey> innerKeySelector,Func<TSource,IEnumerable<TInner>,TResult> resultSelector,IEqualityComparer<TKey> comparer);\n\tILinq<TSource> Intersect(IEnumerable<TSource> second);\n\tILinq<TSource> Intersect(IEnumerable<TSource> second,IEqualityComparer<TSource> comparer);\n\tILinq<TResult> Join<TInner,TKey,TResult>(IEnumerable<TInner> inner,Func<TSource,TKey> outerKeySelector,Func<TInner,TKey> innerKeySelector,Func<TSource,TInner,TResult> resultSelector);\n\tILinq<TResult> Join<TInner,TKey,TResult>(IEnumerable<TInner> inner,Func<TSource,TKey> outerKeySelector,Func<TInner,TKey> innerKeySelector,Func<TSource,TInner,TResult> resultSelector,IEqualityComparer<TKey> comparer);\n\tTSource Last();\n\tTSource Last(Func<TSource,Boolean> predicate);\n\tTSource LastOrDefault();\n\tTSource LastOrDefault(Func<TSource,Boolean> predicate);\n\tInt64 LongCount();\n\tInt64 LongCount(Func<TSource,Boolean> predicate);\n\tTSource Max();\n\tInt32 Max(Func<TSource,Int32> selector);\n\tNullable<Int32> Max(Func<TSource,Nullable<Int32>> selector);\n\tInt64 Max(Func<TSource,Int64> selector);\n\tNullable<Int64> Max(Func<TSource,Nullable<Int64>> selector);\n\tSingle Max(Func<TSource,Single> selector);\n\tNullable<Single> Max(Func<TSource,Nullable<Single>> selector);\n\tDouble Max(Func<TSource,Double> selector);\n\tNullable<Double> Max(Func<TSource,Nullable<Double>> selector);\n\tDecimal Max(Func<TSource,Decimal> selector);\n\tNullable<Decimal> Max(Func<TSource,Nullable<Decimal>> selector);\n\tTResult Max<TResult>(Func<TSource,TResult> selector);\n\tTSource Min();\n\tInt32 Min(Func<TSource,Int32> selector);\n\tNullable<Int32> Min(Func<TSource,Nullable<Int32>> selector);\n\tInt64 Min(Func<TSource,Int64> selector);\n\tNullable<Int64> Min(Func<TSource,Nullable<Int64>> selector);\n\tSingle Min(Func<TSource,Single> selector);\n\tNullable<Single> Min(Func<TSource,Nullable<Single>> selector);\n\tDouble Min(Func<TSource,Double> selector);\n\tNullable<Double> Min(Func<TSource,Nullable<Double>> selector);\n\tDecimal Min(Func<TSource,Decimal> selector);\n\tNullable<Decimal> Min(Func<TSource,Nullable<Decimal>> selector);\n\tTResult Min<TResult>(Func<TSource,TResult> selector);\n\tILinq<TResult> OfType<TResult>();\n\tIOrderedLinq<TSource> OrderBy<TKey>(Func<TSource,TKey> keySelector);\n\tIOrderedLinq<TSource> OrderBy<TKey>(Func<TSource,TKey> keySelector,IComparer<TKey> comparer);\n\tIOrderedLinq<TSource> OrderByDescending<TKey>(Func<TSource,TKey> keySelector);\n\tIOrderedLinq<TSource> OrderByDescending<TKey>(Func<TSource,TKey> keySelector,IComparer<TKey> comparer);\n\tILinq<TSource> Prepend(TSource element);\n\tILinq<TSource> Reverse();\n\tILinq<TResult> Select<TResult>(Func<TSource,TResult> selector);\n\tILinq<TResult> Select<TResult>(Func<TSource,Int32,TResult> selector);\n\tILinq<TResult> SelectMany<TResult>(Func<TSource,IEnumerable<TResult>> selector);\n\tILinq<TResult> SelectMany<TResult>(Func<TSource,Int32,IEnumerable<TResult>> selector);\n\tILinq<TResult> SelectMany<TCollection,TResult>(Func<TSource,Int32,IEnumerable<TCollection>> collectionSelector,Func<TSource,TCollection,TResult> resultSelector);\n\tILinq<TResult> SelectMany<TCollection,TResult>(Func<TSource,IEnumerable<TCollection>> collectionSelector,Func<TSource,TCollection,TResult> resultSelector);\n\tBoolean SequenceEqual(IEnumerable<TSource> second);\n\tBoolean SequenceEqual(IEnumerable<TSource> second,IEqualityComparer<TSource> comparer);\n\tTSource Single();\n\tTSource Single(Func<TSource,Boolean> predicate);\n\tTSource SingleOrDefault();\n\tTSource SingleOrDefault(Func<TSource,Boolean> predicate);\n\tILinq<TSource> Skip(Int32 count);\n\tILinq<TSource> SkipLast(Int32 count);\n\tILinq<TSource> SkipWhile(Func<TSource,Boolean> predicate);\n\tILinq<TSource> SkipWhile(Func<TSource,Int32,Boolean> predicate);\n\tInt32 Sum(Func<TSource,Int32> selector);\n\tNullable<Int32> Sum(Func<TSource,Nullable<Int32>> selector);\n\tInt64 Sum(Func<TSource,Int64> selector);\n\tNullable<Int64> Sum(Func<TSource,Nullable<Int64>> selector);\n\tSingle Sum(Func<TSource,Single> selector);\n\tNullable<Single> Sum(Func<TSource,Nullable<Single>> selector);\n\tDouble Sum(Func<TSource,Double> selector);\n\tNullable<Double> Sum(Func<TSource,Nullable<Double>> selector);\n\tDecimal Sum(Func<TSource,Decimal> selector);\n\tNullable<Decimal> Sum(Func<TSource,Nullable<Decimal>> selector);\n\tILinq<TSource> Take(Int32 count);\n\tILinq<TSource> TakeLast(Int32 count);\n\tILinq<TSource> TakeWhile(Func<TSource,Boolean> predicate);\n\tILinq<TSource> TakeWhile(Func<TSource,Int32,Boolean> predicate);\n\tTSource[] ToArray();\n\tDictionary<TKey,TSource> ToDictionary<TKey>(Func<TSource,TKey> keySelector);\n\tDictionary<TKey,TSource> ToDictionary<TKey>(Func<TSource,TKey> keySelector,IEqualityComparer<TKey> comparer);\n\tDictionary<TKey,TElement> ToDictionary<TKey,TElement>(Func<TSource,TKey> keySelector,Func<TSource,TElement> elementSelector);\n\tDictionary<TKey,TElement> ToDictionary<TKey,TElement>(Func<TSource,TKey> keySelector,Func<TSource,TElement> elementSelector,IEqualityComparer<TKey> comparer);\n\tHashSet<TSource> ToHashSet();\n\tHashSet<TSource> ToHashSet(IEqualityComparer<TSource> comparer);\n\tList<TSource> ToList();\n\tILookup<TKey,TSource> ToLookup<TKey>(Func<TSource,TKey> keySelector);\n\tILookup<TKey,TSource> ToLookup<TKey>(Func<TSource,TKey> keySelector,IEqualityComparer<TKey> comparer);\n\tILookup<TKey,TElement> ToLookup<TKey,TElement>(Func<TSource,TKey> keySelector,Func<TSource,TElement> elementSelector);\n\tILookup<TKey,TElement> ToLookup<TKey,TElement>(Func<TSource,TKey> keySelector,Func<TSource,TElement> elementSelector,IEqualityComparer<TKey> comparer);\n\tILinq<TSource> Union(IEnumerable<TSource> second);\n\tILinq<TSource> Union(IEnumerable<TSource> second,IEqualityComparer<TSource> comparer);\n\tILinq<TSource> Where(Func<TSource,Boolean> predicate);\n\tILinq<TSource> Where(Func<TSource,Int32,Boolean> predicate);\n\tILinq<TResult> Zip<TSecond,TResult>(IEnumerable<TSecond> second,Func<TSource,TSecond,TResult> resultSelector);\n}\n\npublic interface IOrderedLinq<TSource> : ILinq<TSource>, IOrderedEnumerable<TSource>\n{\n\tIOrderedLinq<TSource> ThenBy<TKey>(Func<TSource,TKey> keySelector);\n\tIOrderedLinq<TSource> ThenBy<TKey>(Func<TSource,TKey> keySelector,IComparer<TKey> comparer);\n\tIOrderedLinq<TSource> ThenByDescending<TKey>(Func<TSource,TKey> keySelector);\n\tIOrderedLinq<TSource> ThenByDescending<TKey>(Func<TSource,TKey> keySelector,IComparer<TKey> comparer);\n}\n\n//Skipped Methods\n//Double Average(IEnumerable<Int32> source);\n//Nullable<Double> Average(IEnumerable<Nullable<Int32>> source);\n//Double Average(IEnumerable<Int64> source);\n//Nullable<Double> Average(IEnumerable<Nullable<Int64>> source);\n//Single Average(IEnumerable<Single> source);\n//Nullable<Single> Average(IEnumerable<Nullable<Single>> source);\n//Double Average(IEnumerable<Double> source);\n//Nullable<Double> Average(IEnumerable<Nullable<Double>> source);\n//Decimal Average(IEnumerable<Decimal> source);\n//Nullable<Decimal> Average(IEnumerable<Nullable<Decimal>> source);\n//Int32 Max(IEnumerable<Int32> source);\n//Nullable<Int32> Max(IEnumerable<Nullable<Int32>> source);\n//Int64 Max(IEnumerable<Int64> source);\n//Nullable<Int64> Max(IEnumerable<Nullable<Int64>> source);\n//Double Max(IEnumerable<Double> source);\n//Nullable<Double> Max(IEnumerable<Nullable<Double>> source);\n//Single Max(IEnumerable<Single> source);\n//Nullable<Single> Max(IEnumerable<Nullable<Single>> source);\n//Decimal Max(IEnumerable<Decimal> source);\n//Nullable<Decimal> Max(IEnumerable<Nullable<Decimal>> source);\n//Int32 Min(IEnumerable<Int32> source);\n//Nullable<Int32> Min(IEnumerable<Nullable<Int32>> source);\n//Int64 Min(IEnumerable<Int64> source);\n//Nullable<Int64> Min(IEnumerable<Nullable<Int64>> source);\n//Single Min(IEnumerable<Single> source);\n//Nullable<Single> Min(IEnumerable<Nullable<Single>> source);\n//Double Min(IEnumerable<Double> source);\n//Nullable<Double> Min(IEnumerable<Nullable<Double>> source);\n//Decimal Min(IEnumerable<Decimal> source);\n//Nullable<Decimal> Min(IEnumerable<Nullable<Decimal>> source);\n//ILinq<Int32> Range(Int32 start,Int32 count);\n//ILinq<TResult> Repeat<TResult>(TResult element,Int32 count);\n//Int32 Sum(IEnumerable<Int32> source);\n//Nullable<Int32> Sum(IEnumerable<Nullable<Int32>> source);\n//Int64 Sum(IEnumerable<Int64> source);\n//Nullable<Int64> Sum(IEnumerable<Nullable<Int64>> source);\n//Single Sum(IEnumerable<Single> source);\n//Nullable<Single> Sum(IEnumerable<Nullable<Single>> source);\n//Double Sum(IEnumerable<Double> source);\n//Nullable<Double> Sum(IEnumerable<Nullable<Double>> source);\n//Decimal Sum(IEnumerable<Decimal> source);\n//Nullable<Decimal> Sum(IEnumerable<Nullable<Decimal>> source);\n]]></output>\n          </test-case>\n          <test-case id=\"0-1152\" name=\"PythonDynamicLinq\" fullname=\"Dynamitey.Tests.Linq.PythonDynamicLinq\" methodname=\"PythonDynamicLinq\" classname=\"Dynamitey.Tests.Linq\" runstate=\"Runnable\" seed=\"429381325\" result=\"Passed\" start-time=\"2017-08-18 02:58:03Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.551734\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1151\" name=\"PythonDynamicLinqGenericArgs\" fullname=\"Dynamitey.Tests.Linq.PythonDynamicLinqGenericArgs\" methodname=\"PythonDynamicLinqGenericArgs\" classname=\"Dynamitey.Tests.Linq\" runstate=\"Runnable\" seed=\"1820592141\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.080170\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1149\" name=\"SimpleLinqDynamicLinq\" fullname=\"Dynamitey.Tests.Linq.SimpleLinqDynamicLinq\" methodname=\"SimpleLinqDynamicLinq\" classname=\"Dynamitey.Tests.Linq\" runstate=\"Runnable\" seed=\"2053675288\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.031164\" asserts=\"1\">\n            <properties />\n          </test-case>\n        </test-suite>\n        <test-suite type=\"TestFixture\" id=\"0-1154\" name=\"MimicTest\" fullname=\"Dynamitey.Tests.MimicTest\" classname=\"Dynamitey.Tests.MimicTest\" runstate=\"Runnable\" testcasecount=\"12\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.158149\" total=\"12\" passed=\"12\" failed=\"0\" warnings=\"0\" inconclusive=\"0\" skipped=\"0\" asserts=\"36\">\n          <properties />\n          <test-case id=\"0-1163\" name=\"Binary\" fullname=\"Dynamitey.Tests.MimicTest.Binary\" methodname=\"Binary\" classname=\"Dynamitey.Tests.MimicTest\" runstate=\"Runnable\" seed=\"2095842143\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.011562\" asserts=\"8\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1157\" name=\"Call_Method\" fullname=\"Dynamitey.Tests.MimicTest.Call_Method\" methodname=\"Call_Method\" classname=\"Dynamitey.Tests.MimicTest\" runstate=\"Runnable\" seed=\"1551305444\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.011689\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1158\" name=\"Call_Method_With_Parameters\" fullname=\"Dynamitey.Tests.MimicTest.Call_Method_With_Parameters\" methodname=\"Call_Method_With_Parameters\" classname=\"Dynamitey.Tests.MimicTest\" runstate=\"Runnable\" seed=\"1595074022\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.017423\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1161\" name=\"Cast\" fullname=\"Dynamitey.Tests.MimicTest.Cast\" methodname=\"Cast\" classname=\"Dynamitey.Tests.MimicTest\" runstate=\"Runnable\" seed=\"308747842\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.018249\" asserts=\"6\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1159\" name=\"Get_Index\" fullname=\"Dynamitey.Tests.MimicTest.Get_Index\" methodname=\"Get_Index\" classname=\"Dynamitey.Tests.MimicTest\" runstate=\"Runnable\" seed=\"1344352282\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.013848\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1155\" name=\"Get_Property\" fullname=\"Dynamitey.Tests.MimicTest.Get_Property\" methodname=\"Get_Property\" classname=\"Dynamitey.Tests.MimicTest\" runstate=\"Runnable\" seed=\"1264933380\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.010102\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1164\" name=\"Inheritance_Int\" fullname=\"Dynamitey.Tests.MimicTest.Inheritance_Int\" methodname=\"Inheritance_Int\" classname=\"Dynamitey.Tests.MimicTest\" runstate=\"Runnable\" seed=\"1649454998\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.002696\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1166\" name=\"Inheritance_No_Match\" fullname=\"Dynamitey.Tests.MimicTest.Inheritance_No_Match\" methodname=\"Inheritance_No_Match\" classname=\"Dynamitey.Tests.MimicTest\" runstate=\"Runnable\" seed=\"1689324818\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.006071\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1165\" name=\"Inheritance_String\" fullname=\"Dynamitey.Tests.MimicTest.Inheritance_String\" methodname=\"Inheritance_String\" classname=\"Dynamitey.Tests.MimicTest\" runstate=\"Runnable\" seed=\"42242401\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.002464\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1160\" name=\"Set_Index\" fullname=\"Dynamitey.Tests.MimicTest.Set_Index\" methodname=\"Set_Index\" classname=\"Dynamitey.Tests.MimicTest\" runstate=\"Runnable\" seed=\"356011127\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.009625\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1156\" name=\"Set_Property\" fullname=\"Dynamitey.Tests.MimicTest.Set_Property\" methodname=\"Set_Property\" classname=\"Dynamitey.Tests.MimicTest\" runstate=\"Runnable\" seed=\"435349412\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.008847\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1162\" name=\"Unary\" fullname=\"Dynamitey.Tests.MimicTest.Unary\" methodname=\"Unary\" classname=\"Dynamitey.Tests.MimicTest\" runstate=\"Runnable\" seed=\"1292103573\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.015998\" asserts=\"13\">\n            <properties />\n          </test-case>\n        </test-suite>\n        <test-suite type=\"TestFixture\" id=\"0-1167\" name=\"PrivateTest\" fullname=\"Dynamitey.Tests.PrivateTest\" classname=\"Dynamitey.Tests.PrivateTest\" runstate=\"Runnable\" testcasecount=\"7\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.027669\" total=\"7\" passed=\"7\" failed=\"0\" warnings=\"0\" inconclusive=\"0\" skipped=\"0\" asserts=\"7\">\n          <properties />\n          <test-case id=\"0-1172\" name=\"TestCacheableDoNotExposePrivateMethod\" fullname=\"Dynamitey.Tests.PrivateTest.TestCacheableDoNotExposePrivateMethod\" methodname=\"TestCacheableDoNotExposePrivateMethod\" classname=\"Dynamitey.Tests.PrivateTest\" runstate=\"Runnable\" seed=\"470294114\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.001658\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1173\" name=\"TestCacheableExposePrivateMethodViaInstance\" fullname=\"Dynamitey.Tests.PrivateTest.TestCacheableExposePrivateMethodViaInstance\" methodname=\"TestCacheableExposePrivateMethodViaInstance\" classname=\"Dynamitey.Tests.PrivateTest\" runstate=\"Runnable\" seed=\"563202736\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.001060\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1174\" name=\"TestCacheableExposePrivateMethodViaType\" fullname=\"Dynamitey.Tests.PrivateTest.TestCacheableExposePrivateMethodViaType\" methodname=\"TestCacheableExposePrivateMethodViaType\" classname=\"Dynamitey.Tests.PrivateTest\" runstate=\"Runnable\" seed=\"337710871\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.000367\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1171\" name=\"TestInvokeDoNotExposePrivateMethod\" fullname=\"Dynamitey.Tests.PrivateTest.TestInvokeDoNotExposePrivateMethod\" methodname=\"TestInvokeDoNotExposePrivateMethod\" classname=\"Dynamitey.Tests.PrivateTest\" runstate=\"Runnable\" seed=\"624201285\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.001549\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1170\" name=\"TestInvokeInternalTypeMethodAcrossAssemblyBoundries\" fullname=\"Dynamitey.Tests.PrivateTest.TestInvokeInternalTypeMethodAcrossAssemblyBoundries\" methodname=\"TestInvokeInternalTypeMethodAcrossAssemblyBoundries\" classname=\"Dynamitey.Tests.PrivateTest\" runstate=\"Runnable\" seed=\"1040052446\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.002006\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1168\" name=\"TestInvokePrivateMethod\" fullname=\"Dynamitey.Tests.PrivateTest.TestInvokePrivateMethod\" methodname=\"TestInvokePrivateMethod\" classname=\"Dynamitey.Tests.PrivateTest\" runstate=\"Runnable\" seed=\"1387972470\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.001343\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1169\" name=\"TestInvokePrivateMethodAcrossAssemblyBoundries\" fullname=\"Dynamitey.Tests.PrivateTest.TestInvokePrivateMethodAcrossAssemblyBoundries\" methodname=\"TestInvokePrivateMethodAcrossAssemblyBoundries\" classname=\"Dynamitey.Tests.PrivateTest\" runstate=\"Runnable\" seed=\"822398791\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.002104\" asserts=\"1\">\n            <properties />\n          </test-case>\n        </test-suite>\n        <test-suite type=\"TestFixture\" id=\"0-1208\" name=\"TuplerTest\" fullname=\"Dynamitey.Tests.TuplerTest\" classname=\"Dynamitey.Tests.TuplerTest\" runstate=\"Runnable\" testcasecount=\"15\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.161985\" total=\"15\" passed=\"15\" failed=\"0\" warnings=\"0\" inconclusive=\"0\" skipped=\"0\" asserts=\"21\">\n          <properties />\n          <test-case id=\"0-1211\" name=\"DynamicCreateLongTypedTuple\" fullname=\"Dynamitey.Tests.TuplerTest.DynamicCreateLongTypedTuple\" methodname=\"DynamicCreateLongTypedTuple\" classname=\"Dynamitey.Tests.TuplerTest\" runstate=\"Runnable\" seed=\"517847893\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.024512\" asserts=\"2\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1209\" name=\"DynamicCreateTypedTuple\" fullname=\"Dynamitey.Tests.TuplerTest.DynamicCreateTypedTuple\" methodname=\"DynamicCreateTypedTuple\" classname=\"Dynamitey.Tests.TuplerTest\" runstate=\"Runnable\" seed=\"357422467\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.002268\" asserts=\"2\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1210\" name=\"DynamicCreateTypedTuple8\" fullname=\"Dynamitey.Tests.TuplerTest.DynamicCreateTypedTuple8\" methodname=\"DynamicCreateTypedTuple8\" classname=\"Dynamitey.Tests.TuplerTest\" runstate=\"Runnable\" seed=\"624716792\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.004095\" asserts=\"2\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1218\" name=\"DynamicListToTuple\" fullname=\"Dynamitey.Tests.TuplerTest.DynamicListToTuple\" methodname=\"DynamicListToTuple\" classname=\"Dynamitey.Tests.TuplerTest\" runstate=\"Runnable\" seed=\"30651120\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.015493\" asserts=\"2\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1220\" name=\"DynamicListToTuple20\" fullname=\"Dynamitey.Tests.TuplerTest.DynamicListToTuple20\" methodname=\"DynamicListToTuple20\" classname=\"Dynamitey.Tests.TuplerTest\" runstate=\"Runnable\" seed=\"1660771912\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.052925\" asserts=\"2\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1219\" name=\"DynamicListToTuplet8\" fullname=\"Dynamitey.Tests.TuplerTest.DynamicListToTuplet8\" methodname=\"DynamicListToTuplet8\" classname=\"Dynamitey.Tests.TuplerTest\" runstate=\"Runnable\" seed=\"411338359\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.010542\" asserts=\"2\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1221\" name=\"DynamicTupleIndex\" fullname=\"Dynamitey.Tests.TuplerTest.DynamicTupleIndex\" methodname=\"DynamicTupleIndex\" classname=\"Dynamitey.Tests.TuplerTest\" runstate=\"Runnable\" seed=\"530967868\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.002617\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1223\" name=\"DynamicTupleIndex19\" fullname=\"Dynamitey.Tests.TuplerTest.DynamicTupleIndex19\" methodname=\"DynamicTupleIndex19\" classname=\"Dynamitey.Tests.TuplerTest\" runstate=\"Runnable\" seed=\"1524563420\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.003234\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1222\" name=\"DynamicTupleIndex7\" fullname=\"Dynamitey.Tests.TuplerTest.DynamicTupleIndex7\" methodname=\"DynamicTupleIndex7\" classname=\"Dynamitey.Tests.TuplerTest\" runstate=\"Runnable\" seed=\"1926026719\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.001986\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1212\" name=\"DynamicTupleSize\" fullname=\"Dynamitey.Tests.TuplerTest.DynamicTupleSize\" methodname=\"DynamicTupleSize\" classname=\"Dynamitey.Tests.TuplerTest\" runstate=\"Runnable\" seed=\"2012322829\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.000354\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1214\" name=\"DynamicTupleSize20\" fullname=\"Dynamitey.Tests.TuplerTest.DynamicTupleSize20\" methodname=\"DynamicTupleSize20\" classname=\"Dynamitey.Tests.TuplerTest\" runstate=\"Runnable\" seed=\"1293976974\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.001938\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1213\" name=\"DynamicTupleSize8\" fullname=\"Dynamitey.Tests.TuplerTest.DynamicTupleSize8\" methodname=\"DynamicTupleSize8\" classname=\"Dynamitey.Tests.TuplerTest\" runstate=\"Runnable\" seed=\"977426712\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.000424\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1215\" name=\"DynamicTupleToList\" fullname=\"Dynamitey.Tests.TuplerTest.DynamicTupleToList\" methodname=\"DynamicTupleToList\" classname=\"Dynamitey.Tests.TuplerTest\" runstate=\"Runnable\" seed=\"1465658642\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.000530\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1217\" name=\"DynamicTupleToList20\" fullname=\"Dynamitey.Tests.TuplerTest.DynamicTupleToList20\" methodname=\"DynamicTupleToList20\" classname=\"Dynamitey.Tests.TuplerTest\" runstate=\"Runnable\" seed=\"1359224135\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.003125\" asserts=\"1\">\n            <properties />\n          </test-case>\n          <test-case id=\"0-1216\" name=\"DynamicTupleToList8\" fullname=\"Dynamitey.Tests.TuplerTest.DynamicTupleToList8\" methodname=\"DynamicTupleToList8\" classname=\"Dynamitey.Tests.TuplerTest\" runstate=\"Runnable\" seed=\"491244976\" result=\"Passed\" start-time=\"2017-08-18 02:58:04Z\" end-time=\"2017-08-18 02:58:04Z\" duration=\"0.000442\" asserts=\"1\">\n            <properties />\n          </test-case>\n        </test-suite>\n      </test-suite>\n    </test-suite>\n  </test-suite>\n</test-run>"
  },
  {
    "path": "Tests/Curry.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Dynamitey.SupportLibrary;\nusing NUnit.Framework;\n\nnamespace Dynamitey.Tests\n{\n    [TestFixture]\n    public class Curry : Helper\n    {\n        [Test]\n        public void TestBasicDelegateCurry()\n        {\n            Func<int, int, int> tAdd = (x, y) => x + y;\n            var tCurriedAdd4 = Dynamic.Curry(tAdd)(4);\n            var tResult = tCurriedAdd4(6);\n\n\n            Assert.AreEqual(10, tResult);\n\n        }\n\n\n\n        [Test]\n        public void TestBasicNamedCurry()\n        {\n            Func<int, int, int> tSub = (x, y) => x - y;\n            var tCurriedSub7 = Dynamic.Curry(tSub)(arg2: 7);\n            var tResult = tCurriedSub7(arg1: 10);\n\n\n            Assert.AreEqual(3, tResult);\n\n        }\n\n        [Test]\n        public void TestBasicConvertDelegateCurry()\n        {\n            Func<string, string, string> tAdd = (x, y) => x + y;\n            var tCurriedAdd4 = Dynamic.Curry(tAdd)(\"4\");\n            var tCastToFunc = (Func<string, string>)tCurriedAdd4;\n            var tResult2 = tCastToFunc(\"10\");\n\n            Assert.AreEqual(\"410\", tResult2);\n        }\n        [Test]\n        public void TestBasicConvertDelegateCurryReturnValueType()\n        {\n            Func<string, string, int> tAdd = (x, y) => Int32.Parse(x) + Int32.Parse(y);\n            var tCurriedAdd4 = Dynamic.Curry(tAdd)(\"4\");\n            Func<string, int> tCastToFunc = tCurriedAdd4;\n            var tResult2 = tCastToFunc(\"10\");\n\n            Assert.AreEqual(14, tResult2);\n        }\n\n        public delegate bool TestDeclaredDelagate(string value);\n        [Test]\n        public void TestBasicConvertNonGenericDelegate()\n        {\n            Func<string, string, bool> tContains = (x, y) => y.Contains(x);\n            var tCurriedContains = Dynamic.Curry(tContains)(\"it\");\n            TestDeclaredDelagate tCastToDel = tCurriedContains;\n            var tResult = tCastToDel(\"bait\");\n            Assert.AreEqual(true, tResult);\n        }\n        public delegate void TestRunDelagate(string value);\n        [Test]\n        public void TestBasicConvertNonGenericDelegateAction()\n        {\n            var tBool = false;\n            Action<string, string> tContains = (x, y) => tBool = y.Contains(x);\n            var tCurriedContains = Dynamic.Curry(tContains)(\"it\");\n            TestRunDelagate tCastToDel = tCurriedContains;\n            tCastToDel(\"bait\");\n            Assert.AreEqual(true, tBool);\n        }\n\n        [Test]\n        public void TestBasicConvertDelegateCurryParamValueType()\n        {\n            Func<int, int, int> tAdd = (x, y) => x + y;\n            var tCurriedAdd4 = Dynamic.Curry(tAdd)(4);\n            Func<int, int> tCastToFunc = tCurriedAdd4;\n            var tResult2 = tCastToFunc(10);\n\n            Assert.AreEqual(14, tResult2);\n        }\n\n        [Test]\n        public void TestBasicConvertMoreCurryParamValueType()\n        {\n            Func<int, int, int, int> tAdd = (x, y, z) => x + y + z;\n            Func<int, Func<int, int>> Curry1 = Dynamic.Curry(tAdd)(4);\n            Func<int, int> Curry2 = Curry1(6);\n            int tResult = Curry2(10);\n\n            Assert.AreEqual(20, tResult);\n        }\n\n        [Test]\n        public void TestBasicConvertMoreMoreCurryParamValueType()\n        {\n            Func<int, int, int, int, int> tAdd = (x, y, z, bbq) => x + y + z + bbq;\n            Func<int, Func<int, Func<int, Func<int, int>>>> Curry0 = Dynamic.Curry(tAdd);\n            var Curry1 = Curry0(4);\n            var Curry2 = Curry1(5);\n            var Curry3 = Curry2(6);\n            var tResult = Curry3(20);\n\n            Assert.AreEqual(35, tResult);\n        }\n\n\n\n        [Test]\n        public void TestPococMethodCurry()\n        {\n            var tNewObj = new PocoAdder();\n\n            var tCurry = Dynamic.Curry(tNewObj).Add(4);\n            var tResult = tCurry(10);\n            Assert.AreEqual(14, tResult);\n            //Test cached invocation;\n            var tResult2 = tCurry(30);\n            Assert.AreEqual(34, tResult2);\n        }\n\n        [Test]\n        public void TestStaticMethodCurry()\n        {\n\n            var curry = Dynamic.Curry((StaticContext)typeof(string), 5).Format(); // curry method target include argument count\n            curry = curry(\"Test {0}, {1}, {2}, {3}\");\n            curry = curry(\"A\");\n            curry = curry(\"B\");\n            curry = curry(\"C\");\n            string result = curry(\"D\");\n            Assert.AreEqual(\"Test A, B, C, D\", result);\n        }\n\n        [Test]\n        public void TestStaticMethodLongCurry()\n        {\n\n            object curriedJoin = Dynamic.Curry((StaticContext)typeof(string), 51).Join(\",\");\n\n            Func<dynamic, int, dynamic> applyFunc = (result, each) => result(each.ToString());\n\n\n\n            string final = Enumerable.Range(1, 100)\n                .Where(i => i % 2 == 0)\n                .Aggregate(curriedJoin, applyFunc);\n\n            Console.WriteLine(final);\n        }\n\n\n\n        [Test]\n        public void TestStaticMethodLongCurry2()\n        {\n            var tFormat = Enumerable.Range(0, 100).Aggregate(new StringBuilder(), (result, each) => result.Append(\"{\" + each + \"}\")).ToString();\n\n\n            dynamic curriedWrite = Dynamic.Curry(Console.Out, 101).WriteLine(tFormat);\n\n            Func<dynamic, int, dynamic> applyArgs = (result, each) => result(each.ToString());\n\n            Enumerable.Range(0, 100).Aggregate((object)curriedWrite, applyArgs);\n\n        }\n\n\n        [Test]\n        public void TestDynamicMethodCurry()\n        {\n            var tNewObj = Build.NewObject(Add: Return<int>.Arguments<int, int>((x, y) => x + y));\n\n            var tCurry = Dynamic.Curry(tNewObj).Add(4);\n            var tResult = tCurry(10);\n            Assert.AreEqual(14, tResult);\n            //Test cached invocation;\n            var tResult2 = tCurry(30);\n            Assert.AreEqual(34, tResult2);\n        }\n\n        [Test]\n        public void UnboundedCurry()\n        {\n            var tNewObject = Dynamic.Curry(Build.NewObject);\n            var tCurriedNewObject = tNewObject(One: 1);\n            var tResult = tCurriedNewObject(Two: 2);\n            Assert.AreEqual(1, tResult.One);\n            Assert.AreEqual(2, tResult.Two);\n\n        }\n        [Test]\n        public void UnboundedCurryCont()\n        {\n            var tNewObject = Dynamic.Curry(Build.NewObject);\n            tNewObject = tNewObject(One: 1);\n            tNewObject = Dynamic.Curry(tNewObject)(Two: 2);\n            var tResult = tNewObject(Three: 3);\n            Assert.AreEqual(1, tResult.One);\n            Assert.AreEqual(2, tResult.Two);\n            Assert.AreEqual(3, tResult.Three);\n        }\n\n        [Test]\n        public void BoundedCurryCont()\n        {\n            var tNewObject = Dynamic.Curry(Build.NewObject, 3);\n            tNewObject = tNewObject(One: 1);\n            tNewObject = tNewObject(Two: 2);\n            var tResult = tNewObject(Three: 3);\n            Assert.AreEqual(1, tResult.One);\n            Assert.AreEqual(2, tResult.Two);\n            Assert.AreEqual(3, tResult.Three);\n        }\n\n        [Test]\n        public void TestCurryNamedMethods()\n        {\n            Person adam = new Person();\n            dynamic jump = Dynamic.Curry(adam).Jump();\n\n            Assert.Throws<NotImplementedException>(() => jump(cheer: \"yay\", height: (uint)3));\n        }\n\n        private class Person\n        {\n            public void Jump(uint height, string cheer)\n            {\n                throw new NotImplementedException();\n            }\n        }\n\n\n        [Test]\n        public void TestPococMethodPartialApply()\n        {\n            var tNewObj = new PocoAdder();\n            var tCurry = Dynamic.Curry(tNewObj).Add(4, 6);\n            var tResult = tCurry();\n            Assert.AreEqual(10, tResult);\n        }\n\n        [Test]\n        public void UnboundedPartialApply()\n        {\n            var tNewObject = Dynamic.Curry(Build.NewObject);\n            tNewObject = tNewObject(One: 1, Two: 2);\n            var tResult = tNewObject(Three: 3, Four: 4);\n            Assert.AreEqual(1, tResult.One);\n            Assert.AreEqual(2, tResult.Two);\n            Assert.AreEqual(3, tResult.Three);\n            Assert.AreEqual(4, tResult.Four);\n\n        }\n\n        [Test]\n        public void BasicCurryTest()\n        {\n            Func<int, double, float, double> adder = (x, y, z) => x + y + z;\n\n            var curried = Dynamic.Curry(adder);\n\n            Assert.AreEqual(6, curried(1, 2, 3));\n\n            Assert.AreEqual(6, curried(1, 2)(3));\n\n            Assert.AreEqual(6, curried(1)(2, 3));\n\n            Assert.AreEqual(6, curried(1)(2)(3));\n        }\n\n        [Test]\n        public void CurryLeftPipeTest()\n        {\n            Func<string, string, string, string> adder = (x, y, z) => x + y + z;\n\n            var curried = Dynamic.Curry(adder);\n\n          \n            Assert.That((object)(curried << \"1\" << \"2\" << \"3\"), Is.EqualTo(\"123\"));\n        }\n\n\n        [Test]\n        public void CurryRightPipeTest()\n        {\n            Func<string, string, string, string> adder = (x, y, z) => x + y + z;\n\n            var curried = Dynamic.Curry(adder);\n\n\n            Assert.That((object) (\"1\" | ( \"2\" | (\"3\" | curried))), Is.EqualTo(\"321\"));\n        }\n    }\n}\n"
  },
  {
    "path": "Tests/DynamicObjects.cs",
    "content": "﻿using System;\nusing System.CodeDom.Compiler;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Dynamic;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Threading.Tasks;\n\nusing Dynamitey.SupportLibrary;\nusing Microsoft.CSharp;\nusing NUnit.Framework;\n\nnamespace Dynamitey.Tests\n{\n    [TestFixture]\n    public class DynamicObjs : Helper\n    {\n\n\n\n\n        [Test]\n        public void GetterAnonTest()\n        {\n            var tAnon = new {Prop1 = \"Test\", Prop2 = 42L, Prop3 = Guid.NewGuid()};\n\n            dynamic tTest = new DynamicObjects.Get(tAnon);\n\n            Assert.AreEqual(tAnon.Prop1, tTest.Prop1);\n            Assert.AreEqual(tAnon.Prop2, tTest.Prop2);\n            Assert.AreEqual(tAnon.Prop3, tTest.Prop3);\n        }\n\n        [Test]\n        public void GetterVoidTest()\n        {\n            var tPoco = new VoidMethodPoco();\n\n            dynamic tTest = new DynamicObjects.Get(tPoco);\n\n            tTest.Action();\n        }\n\n        [Test]\n        public void GetterArrayTest()\n        {\n\n\n            var tArray = new int[] {1, 2, 3};\n\n            dynamic tTest = new DynamicObjects.Get(tArray);\n            Dynamic.ApplyEquivalentType(tTest, typeof (IStringIntIndexer));\n\n            Assert.AreEqual(tArray[2].ToString(), tTest[2]);\n        }\n\n        [Test]\n        public void GetterEventTest()\n        {\n            dynamic dynEvent = new DynamicObjects.Get(new PocoEvent());\n            Dynamic.ApplyEquivalentType(dynEvent, typeof (IEvent));\n            var tSet = false;\n            EventHandler<EventArgs> tActsLikeOnEvent = (obj, args) => tSet = true;\n            dynEvent.Event += tActsLikeOnEvent;\n\n            dynEvent.OnEvent(null, null);\n            Assert.AreEqual(true, tSet);\n\n        }\n\n\n        [Test]\n        public void GetterEventTest2()\n        {\n            dynamic dynEvent = new DynamicObjects.Get(new PocoEvent());\n            Dynamic.ApplyEquivalentType(dynEvent, typeof (IEvent));\n            var tSet = false;\n            EventHandler<EventArgs> tActsLikeOnEvent = (obj, args) => tSet = true;\n            dynEvent.Event += tActsLikeOnEvent;\n            dynEvent.Event -= tActsLikeOnEvent;\n            dynEvent.OnEvent(null, null);\n            Assert.AreEqual(false, tSet);\n\n        }\n\n\n        [Test]\n        public void GetterDynamicTest()\n        {\n            dynamic tNew = new ExpandoObject();\n            tNew.Prop1 = \"Test\";\n            tNew.Prop2 = 42L;\n            tNew.Prop3 = Guid.NewGuid();\n\n            dynamic tTest = new DynamicObjects.Get(tNew);\n\n\n            Assert.AreEqual(tNew.Prop1, tTest.Prop1);\n            Assert.AreEqual(tNew.Prop2, tTest.Prop2);\n            Assert.AreEqual(tNew.Prop3, tTest.Prop3);\n        }\n\n        public class TestForwarder : Dynamitey.DynamicObjects.BaseForwarder\n        {\n            public TestForwarder(object target)\n                : base(target)\n            {\n            }\n        }\n\n        [Test]\n        public void ForwardAnonTest()\n        {\n            var tAnon = new {Prop1 = \"Test\", Prop2 = 42L, Prop3 = Guid.NewGuid()};\n\n            dynamic tTest = new TestForwarder(tAnon);\n\n            Assert.AreEqual(tAnon.Prop1, tTest.Prop1);\n            Assert.AreEqual(tAnon.Prop2, tTest.Prop2);\n            Assert.AreEqual(tAnon.Prop3, tTest.Prop3);\n        }\n\n        [Test]\n        public void ForwardVoidTest()\n        {\n            var tPoco = new VoidMethodPoco();\n\n            dynamic tTest = new TestForwarder(tPoco);\n\n            tTest.Action();\n        }\n\n\n        [Test]\n        public void ForwardGenericMethodsTest()\n        {\n            dynamic tNew = new ForwardGenericMethodsTestClass();\n\n            dynamic tFwd = new TestForwarder(tNew);\n\n            Assert.AreEqual(\"test99\", tFwd.Create<ForwardGenericMethodsTestClass>(99).Value);\n        }\n\n\n        [Test]\n        public void ForwardDynamicTest()\n        {\n            dynamic tNew = new ExpandoObject();\n            tNew.Prop1 = \"Test\";\n            tNew.Prop2 = 42L;\n            tNew.Prop3 = Guid.NewGuid();\n\n            dynamic tTest = new TestForwarder(tNew);\n\n\n            Assert.AreEqual(tNew.Prop1, tTest.Prop1);\n            Assert.AreEqual(tNew.Prop2, tTest.Prop2);\n            Assert.AreEqual(tNew.Prop3, tTest.Prop3);\n        }\n\n        [Test]\n        public void DictionaryMethodsTest()\n        {\n\n            dynamic tNew = new DynamicObjects.Dictionary();\n            tNew.Action1 = new Action(Assert.Fail);\n            tNew.Action2 = new Action<bool>(Assert.IsFalse);\n            tNew.Action3 = new Func<string>(() => \"test\");\n            tNew.Action4 = new Func<int, string>(arg => \"test\" + arg);\n\n\n\n\n\n            Assert.That(() => tNew.Action1(), Throws.InstanceOf<AssertionException>());\n            Assert.That(() => tNew.Action2(true), Throws.InstanceOf<AssertionException>());\n\n            Assert.That((object)tNew.Action3(), Is.EqualTo(\"test\"));\n\n            Assert.That((object)tNew.Action4(4), Is.EqualTo(\"test4\"));\n        }\n\n        [Test]\n        public void ForwardMethodsTest()\n        {\n\n            dynamic tNew = new DynamicObjects.Dictionary();\n            tNew.Action1 = new Action(Assert.Fail);\n            tNew.Action2 = new Action<bool>(Assert.IsFalse);\n            tNew.Action3 = new Func<string>(() => \"test\");\n            tNew.Action4 = new Func<int, string>(arg => \"test\" + arg);\n\n\n            dynamic tFwd = new TestForwarder(tNew);\n\n\n\n            Assert.That(() => tFwd.Action1(), Throws.InstanceOf<AssertionException>());\n            Assert.That(() => tFwd.Action2(true), Throws.InstanceOf<AssertionException>());\n\n            Assert.That((object)tFwd.Action3(), Is.EqualTo(\"test\"));\n\n            Assert.That((object)tFwd.Action4(4), Is.EqualTo(\"test4\"));\n        }\n\n        [Test]\n        public void DictionaryMethodsOutTest()\n        {\n\n            dynamic tNew = new DynamicObjects.Dictionary();\n            tNew.Func = new DynamicTryString(TestOut);\n\n            Assert.AreEqual(true, tNew.Func(null, \"Test\", out string tOut));\n            Assert.AreEqual(\"Test\", tOut);\n\n            Assert.AreEqual(false, tNew.Func(null, 1, out string tOut2));\n            Assert.AreEqual(null, tOut2);\n        }\n\n        private static object TestOut(CallSite dummy, object @in, out string @out)\n        {\n            @out = @in as string;\n\n            return @out != null;\n        }\n\n\n        [Test]\n        public void DictionaryMethodsTestWithPropertyAccess()\n        {\n\n            dynamic tNew = new DynamicObjects.Dictionary();\n            tNew.PropCat = \"Cat-\";\n            tNew.Action1 = new Action(Assert.Fail);\n            tNew.Action2 = new Action<bool>(Assert.IsFalse);\n            tNew.Action3 = new ThisFunc<string>(@this => @this.PropCat + \"test\");\n\n\n\n            Assert.That(() => tNew.Action1(), Throws.InstanceOf<AssertionException>());\n            Assert.That(() => tNew.Action2(true), Throws.InstanceOf<AssertionException>());\n\n            Assert.AreEqual(\"Cat-test\", tNew.Action3());\n\n\n        }\n\n        [Test]\n        public void DictionaryNullMethodsTest()\n        {\n\n            dynamic tNew = new DynamicObjects.Dictionary();\n            Dynamic.ApplyEquivalentType(tNew, typeof (ISimpleStringMethod));\n\n            Assert.That((object)tNew.StartsWith(\"Te\"), Is.False);\n\n\n\n        }\n\n\n        [Test]\n        public void DynamicDictionaryWrappedTest()\n        {\n\n            var tDictionary = new Dictionary<string, object>\n                                  {\n                                      {\"Test1\", 1},\n                                      {\"Test2\", 2},\n                                      {\n                                          \"TestD\", new Dictionary<string, object>()\n                                                       {\n                                                           {\"TestA\", \"A\"},\n                                                           {\"TestB\", \"B\"}\n                                                       }\n                                      }\n                                  };\n\n            dynamic tNew = new DynamicObjects.Dictionary(tDictionary);\n\n            Assert.AreEqual(1, tNew.Test1);\n            Assert.AreEqual(2, tNew.Test2);\n            Assert.AreEqual(\"A\", tNew.TestD.TestA);\n            Assert.AreEqual(\"B\", tNew.TestD.TestB);\n        }\n\n        [Test]\n        public void InterfaceDictionaryWrappedTest()\n        {\n\n            var tDictionary = new Dictionary<string, object>\n                                  {\n                                      {\"Test1\", 1},\n                                      {\"Test2\", 2L},\n                                      {\"Test3\", 1},\n                                      {\"Test4\", \"Two\"},\n                                      {\n                                          \"TestD\", new Dictionary<string, object>()\n                                                       {\n                                                           {\"TestA\", \"A\"},\n                                                           {\"TestB\", \"B\"}\n                                                       }\n                                      }\n                                  };\n\n            dynamic tDynamic = new DynamicObjects.Dictionary(tDictionary);\n            dynamic tNotDynamic = new DynamicObjects.Dictionary(tDictionary);\n\n\n            Dynamic.ApplyEquivalentType(tDynamic, typeof (IDynamicDict));\n            Dynamic.ApplyEquivalentType(tNotDynamic, typeof (INonDynamicDict));\n\n\n            Assert.AreEqual(tDynamic, tNotDynamic);\n\n            Assert.AreEqual(1, tDynamic.Test1);\n            Assert.AreEqual(2L, tDynamic.Test2);\n            Assert.AreEqual(TestEnum.One, tDynamic.Test3);\n            Assert.AreEqual(TestEnum.Two, tDynamic.Test4);\n\n            Assert.AreEqual(\"A\", tDynamic.TestD.TestA);\n            Assert.AreEqual(\"B\", tDynamic.TestD.TestB);\n\n            Assert.AreEqual(1, tNotDynamic.Test1);\n            Assert.AreEqual(2L, tNotDynamic.Test2);\n            Assert.AreEqual(TestEnum.One, tNotDynamic.Test3);\n            Assert.AreEqual(TestEnum.Two, tNotDynamic.Test4);\n\n            Assert.AreEqual(typeof (Dictionary<string, object>), tNotDynamic.TestD.GetType());\n            Assert.AreEqual(typeof (DynamicObjects.Dictionary), tDynamic.TestD.GetType());\n        }\n\n        [Test]\n        public void DynamicObjectEqualsTest()\n        {\n            var tDictionary = new Dictionary<string, object>\n                                  {\n                                      {\"Test1\", 1},\n                                      {\"Test2\", 2},\n                                      {\n                                          \"TestD\", new Dictionary<string, object>()\n                                                       {\n                                                           {\"TestA\", \"A\"},\n                                                           {\"TestB\", \"B\"}\n                                                       }\n                                      }\n                                  };\n\n            dynamic tDynamic = new DynamicObjects.Dictionary(tDictionary);\n            dynamic tNotDynamic = new DynamicObjects.Dictionary(tDictionary);\n\n\n            Dynamic.ApplyEquivalentType(tDynamic, typeof (IDynamicDict));\n            Dynamic.ApplyEquivalentType(tNotDynamic, typeof (INonDynamicDict));\n\n            Assert.AreEqual(tDynamic, tNotDynamic);\n\n            Assert.AreEqual(tDynamic, tDictionary);\n\n            Assert.AreEqual(tNotDynamic, tDictionary);\n        }\n\n        [Test]\n        public void DynamicAnnonymousWrapper()\n        {\n            var tData = new Dictionary<int, string> {{1, \"test\"}};\n            var tDyn = DynamicObjects.Get.Create(new\n                                                     {\n                                                         Test1 = 1,\n                                                         Test2 = \"2\",\n                                                         IsGreaterThan5 = Return<bool>.Arguments<int>(it => it > 5),\n                                                         ClearData = ReturnVoid.Arguments(() => tData.Clear())\n                                                     });\n\n            Assert.AreEqual(1, tDyn.Test1);\n            Assert.AreEqual(\"2\", tDyn.Test2);\n            Assert.AreEqual(true, tDyn.IsGreaterThan5(6));\n            Assert.AreEqual(false, tDyn.IsGreaterThan5(4));\n\n            Assert.AreEqual(1, tData.Count);\n            tDyn.ClearData();\n            Assert.AreEqual(0, tData.Count);\n\n        }\n\n        [Test]\n        public void TestAnonInterface()\n        {\n            dynamic tInterface = new DynamicObjects.Get(new\n                                                            {\n                                                                CopyArray =\n                                                            ReturnVoid.Arguments<Array, int>(\n                                                                (ar, i) => Enumerable.Range(1, 10)),\n                                                                Count = 10,\n                                                                IsSynchronized = false,\n                                                                SyncRoot = this,\n                                                                GetEnumerator =\n                                                            Return<IEnumerator>.Arguments(\n                                                                () => Enumerable.Range(1, 10).GetEnumerator())\n                                                            });\n\n            Dynamic.ApplyEquivalentType(tInterface, typeof (ICollection), typeof (IEnumerable));\n\n            Assert.AreEqual(10, tInterface.Count);\n            Assert.AreEqual(false, tInterface.IsSynchronized);\n            Assert.AreEqual(this, tInterface.SyncRoot);\n            Assert.That((object)tInterface.GetEnumerator(), Is.InstanceOf<IEnumerator>());\n        }\n\n        [Test]\n        public void TestBuilder()\n        {\n            var New = Builder.New<ExpandoObject>();\n\n            var tExpando = New.Object(\n                Test: \"test1\",\n                Test2: \"Test 2nd\"\n                );\n            Assert.AreEqual(\"test1\", tExpando.Test);\n            Assert.AreEqual(\"Test 2nd\", tExpando.Test2);\n\n            dynamic NewD = new DynamicObjects.Builder<ExpandoObject>();\n\n\n            var tExpandoNamedTest = NewD.Robot(\n                LeftArm: \"Rise\",\n                RightArm: \"Clamp\"\n                );\n\n            Assert.AreEqual(\"Rise\", tExpandoNamedTest.LeftArm);\n            Assert.AreEqual(\"Clamp\", tExpandoNamedTest.RightArm);\n        }\n\n        [Test]\n        public void TestSetupOtherTypes()\n        {\n            var New = Builder.New().Setup(\n                Expando: typeof (ExpandoObject),\n                Dict: typeof (DynamicObjects.Dictionary)\n                );\n\n            var tExpando = New.Expando(\n                LeftArm: \"Rise\",\n                RightArm: \"Clamp\"\n                );\n\n            var tDict = New.Dict(\n                LeftArm: \"RiseD\",\n                RightArm: \"ClampD\"\n                );\n\n            Assert.AreEqual(\"Rise\", tExpando.LeftArm);\n            Assert.AreEqual(\"Clamp\", tExpando.RightArm);\n            Assert.AreEqual(typeof (ExpandoObject), tExpando.GetType());\n\n            Assert.AreEqual(\"RiseD\", tDict.LeftArm);\n            Assert.AreEqual(\"ClampD\", tDict.RightArm);\n            Assert.AreEqual(typeof (DynamicObjects.Dictionary), tDict.GetType());\n\n        }\n\n        [Test]\n\n        //This test data is modified from MS-PL Clay project http://clay.codeplex.com\n        public void TestClayFactorySyntax()\n        {\n            dynamic New = Builder.New();\n\n            {\n                var person = New.Person();\n                person.FirstName = \"Louis\";\n                person.LastName = \"Dejardin\";\n                Assert.AreEqual(\"Louis\", person.FirstName);\n                Assert.AreEqual(\"Dejardin\", person.LastName);\n            }\n            {\n                var person = New.Person();\n                person[\"FirstName\"] = \"Louis\";\n                person[\"LastName\"] = \"Dejardin\";\n                Assert.AreEqual(\"Louis\", person.FirstName);\n                Assert.AreEqual(\"Dejardin\", person.LastName);\n            }\n            {\n                var person = New.Person(\n                    FirstName: \"Bertrand\",\n                    LastName: \"Le Roy\"\n                    ).Aliases(\"bleroy\", \"boudin\");\n\n                Assert.AreEqual(\"Bertrand\", person.FirstName);\n                Assert.AreEqual(\"Le Roy\", person.LastName);\n                Assert.AreEqual(\"boudin\", person.Aliases[1]);\n            }\n\n            {\n                var person = New.Person()\n                                .FirstName(\"Louis\")\n                                .LastName(\"Dejardin\")\n                                .Aliases(new[] {\"Lou\"});\n\n                Assert.AreEqual(person.FirstName, \"Louis\");\n                Assert.AreEqual(person.Aliases[0], \"Lou\");\n            }\n\n            {\n                var person = New.Person(new\n                                            {\n                                                FirstName = \"Louis\",\n                                                LastName = \"Dejardin\"\n                                            });\n                Assert.AreEqual(person.FirstName, \"Louis\");\n                Assert.AreEqual(person.LastName, \"Dejardin\");\n            }\n\n        }\n\n\n\n\n\n        [Test]\n        //This test data is modified from MS-PL Clay project http://clay.codeplex.com\n        public void TestFactoryListSyntax()\n        {\n            dynamic New = Builder.New();\n\n            //Test using Clay Syntax\n            var people = New.Array(\n                New.Person().FirstName(\"Louis\").LastName(\"Dejardin\"),\n                New.Person().FirstName(\"Bertrand\").LastName(\"Le Roy\")\n                );\n\n            Assert.AreEqual(\"Dejardin\", people[0].LastName);\n            Assert.AreEqual(\"Le Roy\", people[1].LastName);\n\n            var people2 = new DynamicObjects.List()\n                              {\n                                  New.Robot(Name: \"Bender\"),\n                                  New.Robot(Name: \"RobotDevil\")\n                              };\n\n\n            Assert.AreEqual(\"Bender\", people2[0].Name);\n            Assert.AreEqual(\"RobotDevil\", people2[1].Name);\n\n        }\n\n        [Test]\n        public void TestQuicListSyntax()\n        {\n            var tList = Build.NewList(\"test\", \"one\", \"two\");\n            Assert.AreEqual(\"one\", tList[1]);\n\n            var tList2 = Build.NewList(\"test\", \"one\", \"two\", \"three\");\n            Assert.AreEqual(\"three\", tList2[3]);\n        }\n\n\n        [Test]\n        public void TestRecorder()\n        {\n            dynamic New = Builder.New<DynamicObjects.Recorder>();\n\n            DynamicObjects.Recorder tRecording = New.Watson(Test: \"One\", Test2: 2, NameLast: \"Watson\");\n\n\n            dynamic tVar = tRecording.ReplayOn(new ExpandoObject());\n\n            Assert.AreEqual(\"One\", tVar.Test);\n            Assert.AreEqual(2, tVar.Test2);\n            Assert.AreEqual(\"Watson\", tVar.NameLast);\n        }\n\n\n#if NETFRAMEWORK\n\n        [Test]\n        public void TestCodeDomLateTypeBind()\n        {  \n            // http://stackoverflow.com/questions/16918612/dynamically-use-runtime-compiled-assemlby/16920438#16920438\n            string code = @\"\n                namespace CodeInjection\n                {\n                    public static class DynConcatenateString\n                    {\n                        public static string Concatenate(string s1, string s2){\n                            return s1 + \"\" ! \"\" + s2;\n                        }\n                    }\n                }\";\n   \n            var codeProvider = new CSharpCodeProvider();\n \n            var parameters = new CompilerParameters {GenerateExecutable = false, GenerateInMemory = true};\n\n            CompilerResults cr = codeProvider.CompileAssemblyFromSource(parameters,code);\n\n\n            dynamic DynConcatenateString = new DynamicObjects.LateType(cr.CompiledAssembly, \"CodeInjection.DynConcatenateString\");\n\n\n            Assert.That(\"1 ! 2\", Is.EqualTo(DynConcatenateString.Concatenate(\"1\",\"2\")));\n\n        }\n    \n#endif\n\n\n    [Test]\n        public void TestLateLibrarybind()\n        {\n\n            dynamic tBigIntType =\n                new DynamicObjects.LateType(\n                    \"System.Numerics.BigInteger, System.Numerics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\");\n\n            if (tBigIntType.IsAvailable)\n            {\n\n                var one = tBigIntType.@new(1);\n                var two = tBigIntType.@new(2);\n\n                Assert.IsFalse(one.IsEven);\n                Assert.AreEqual(true, two.IsEven);\n\n                var tParsed = tBigIntType.Parse(\"4\");\n\n                Assert.AreEqual(true, tParsed.IsEven);\n\n\n\n            }\n            else\n            {\n\n                Assert.Fail(\"Big Int Didn't Load\");\n\n\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "Tests/ExpandoObjs.cs",
    "content": "﻿using System.Dynamic;\nusing NUnit.Framework;\n\nnamespace Dynamitey.Tests\n{\n    [TestFixture]\n    public class ExpandoObjs : Helper\n    {\n        [Test]\n        public void TestExpando()\n        {\n            var New = Builder.New<ExpandoObject>();\n\n            var tExpando = New.Object(\n                Test: \"test1\",\n                Test2: \"Test 2nd\"\n                );            \n\n            var tExpandoNew = Expando.New(\n                Test: \"test1\",\n                Test2: \"Test 2nd\"\n                );\n\n\n            Assert.AreEqual(\"test1\", tExpandoNew.Test);\n            Assert.AreEqual(\"Test 2nd\", tExpandoNew.Test2);\n\n            Assert.AreEqual(tExpando.Test, tExpandoNew.Test);\n            Assert.AreEqual(tExpando.Test2, tExpandoNew.Test2);\n            Assert.AreEqual(tExpando.GetType(), tExpandoNew.GetType());\n        }\n\n\n        [Test]\n        public void TestExpando2()\n        {            \n            dynamic NewD = new DynamicObjects.Builder<ExpandoObject>();\n\n            var tExpandoNamedTest = NewD.Robot(\n                LeftArm: \"Rise\",\n                RightArm: \"Clamp\"\n                );\n\n            dynamic NewE = new Expando();\n\n            var tExpandoNamedTestShortcut = NewE.Robot(\n               LeftArm: \"Rise\",\n               RightArm: \"Clamp\"\n               );\n\n            Assert.AreEqual(\"Rise\", tExpandoNamedTestShortcut.LeftArm);\n            Assert.AreEqual(\"Clamp\", tExpandoNamedTestShortcut.RightArm);\n\n            Assert.AreEqual(tExpandoNamedTest.LeftArm, tExpandoNamedTestShortcut.LeftArm);\n            Assert.AreEqual(tExpandoNamedTest.RightArm, tExpandoNamedTestShortcut.RightArm);\n            Assert.AreEqual(tExpandoNamedTest.GetType(), tExpandoNamedTestShortcut.GetType());\n        }\n    }\n}\n"
  },
  {
    "path": "Tests/Helper.cs",
    "content": "using NUnit.Framework;\n\nnamespace Dynamitey.Tests\n{\n#pragma warning disable CS0618 // Type or member is obsolete\n    public class Helper:AssertionHelper\n#pragma warning restore CS0618 // Type or member is obsolete\n    {\n        \n    }\n}"
  },
  {
    "path": "Tests/Impromptu.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing NUnit.Framework;\nusing Dynamitey;\nusing Dynamitey.DynamicObjects;\nusing Dynamitey.SupportLibrary;\nusing ImpromptuInterface;\nusing NUnit.Framework.Constraints;\n\nnamespace Dynamitey.Tests\n{\n    [TestFixture(Category = \"Impromptu\")]\n    public class Impromptu:Helper\n    {\n\n        public static readonly dynamic Interfacing \n            = Dynamic.Curry(new Func<object,dynamic>(it=>ImpromptuInterface.Impromptu.ActLike(it)));\n\n\n\n        [Test]\n        public void DictionaryInterfaceNullMethodsTest()\n        {\n            dynamic tNew = new DynamicObjects.Dictionary();\n\n            ISimpleStringMethod tActsLike = ImpromptuInterface.Impromptu.ActLike(tNew);\n\n            Assert.AreEqual(false, tActsLike.StartsWith(\"Te\"));\n        }\n\n\n        [Test]\n        public void FauxTypeTest()\n        {\n            var testProp = new Dictionary<String,Type>(){\n                {\"test\", typeof(bool)}\n            };\n\n            \n            var propType = new PropretySpecType(testProp);\n\n            var propMembers = propType.GetMemberNames();\n            Expect(propMembers, Contains(\"test\"));\n            \n            var realType = new RealType(typeof(ISimpeleClassProps));\n            var realMembers = realType.GetMemberNames();\n\n            Expect(realMembers, Contains(\"Prop2\"));\n\n            \n\n            var aggrType = new AggreType(propType, realType);\n            \n            var aggrMembers = aggrType.GetMemberNames();\n\n            Expect(aggrMembers, Contains(\"Prop2\"));\n            Expect(aggrMembers, Contains(\"test\"));\n\n        }\n        \n\n        [Test]\n        public void PropertySpecTest()\n        {\tvar testProp = new Dictionary<String,Type>(){\n                {\"test\", typeof(bool)}\n            };\n            \n            var baseObj = new DynamicObjects.Dictionary();\n            var output = ImpromptuInterface.Impromptu.ActLikeProperties(baseObj,testProp);\n\n            if (baseObj.TryTypeForName(\"test\", out Type ot))\n            {\n                Assert.AreEqual(typeof(bool), ot);\n            }\n            else\n            {\n                Assert.Fail(\"Could not find property spec for member\");\n            }\n        }\n        \n        [Test]\n        public void InterfaceSpecTest()\n        {\t\n            var baseObj = new DynamicObjects.Dictionary();\n            var output = ImpromptuInterface.Impromptu.ActLike<ISimpeleClassProps>(baseObj);\n\n            if (baseObj.TryTypeForName(\"Prop2\", out Type ot))\n            {\n                Assert.AreEqual(typeof(long), ot);\n            }\n            else\n            {\n                Assert.Fail(\"Could not find property spec for member\");\n            }\n        }\n\n\n        [Test]\n        public void DictionaryCurriedAcctlikeNullMethodsTest()\n        {\n\n            ISimpleStringMethod tActsLike = Interfacing << new DynamicObjects.Dictionary();\n\n            Assert.AreEqual(false, tActsLike.StartsWith(\"Te\"));\n\n\n\n        }\n\n        public interface IBuilder\n        {\n            INest Nester(object props);\n            INested Nester2(object props);\n\n            [ImpromptuInterface.UseNamedArgument]\n            INest Nester(string NameLevel1, INested Nested);\n\n            INested Nester2([ImpromptuInterface.UseNamedArgument] string NameLevel2);\n        }\n\n        public interface INest\n        {\n            String NameLevel1 { get; set; }\n            INested Nested { get; set; }\n        }\n\n\n        public interface INested\n        {\n            string NameLevel2 { get; }\n        }\n\n\n\n\n        [Test]\n        public void TestBuilderActLikeAnon()\n        {\n            IBuilder New = Interfacing << Builder.New();\n\n            var tNest = New.Nester(new\n            {\n                NameLevel1 = \"Lvl1\",\n                Nested = New.Nester2(new\n                {\n                    NameLevel2 = \"Lvl2\"\n                })\n            });\n\n            Assert.AreEqual(\"Lvl1\", tNest.NameLevel1);\n            Assert.AreEqual(\"Lvl2\", tNest.Nested.NameLevel2);\n        }\n\n        [Test]\n        public void TestBuilderActLikeNamed()\n        {\n            IBuilder New = ImpromptuInterface.Impromptu.ActLike(Builder.New());\n\n            var tNest = New.Nester(\n                NameLevel1: \"Lvl1\",\n                Nested: New.Nester2(\n                    NameLevel2: \"Lvl2\"\n                    )\n                );\n\n            Assert.AreEqual(\"Lvl1\", tNest.NameLevel1);\n            Assert.AreEqual(\"Lvl2\", tNest.Nested.NameLevel2);\n        }\n\n    }\n}\n"
  },
  {
    "path": "Tests/Invoke.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Drawing;\nusing System.Dynamic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Text;\nusing System.Xml.Linq;\nusing Dynamitey.SupportLibrary;\nusing Microsoft.CSharp.RuntimeBinder;\nusing Moq;\nusing NUnit.Framework;\nusing System.Globalization;\n\nnamespace Dynamitey.Tests\n{\n    public class Invoke:Helper\n    {\n        [OneTimeTearDown]\n        public void DestroyCaches()\n        {\n            Dynamic.ClearCaches();\n        }\n\n\n        [Test]\n        public void TestDynamicSet()\n        {\n            dynamic tExpando = new ExpandoObject();\n\n            var tSetValue = \"1\";\n\n            Dynamic.InvokeSet(tExpando, \"Test\", tSetValue);\n\n            Assert.AreEqual(tSetValue, tExpando.Test);\n\n        }\n\n\n\n        [Test]\n        public void TestPocoSet()\n        {\n            var tPoco = new PropPoco();\n\n            var tSetValue = \"1\";\n\n            Dynamic.InvokeSet(tPoco, \"Prop1\", tSetValue);\n\n            Assert.AreEqual(tSetValue, tPoco.Prop1);\n\n        }\n\n\n        [Test]\n        public void TestStructSet()\n        {\n            object tPoco = new PropStruct();\n\n            var tSetValue = \"1\";\n\n            Dynamic.InvokeSet(tPoco, \"Prop1\", tSetValue);\n\n            Assert.AreEqual(tSetValue, ((PropStruct)tPoco).Prop1);\n\n        }\n\n        [Test]\n        public void TestCacheableDyanmicSetAndPocoSetAndSetNull()\n        {\n            dynamic tExpando = new ExpandoObject();\n            var tSetValueD = \"4\";\n\n\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.Set, \"Prop1\");\n\n            tCachedInvoke.Invoke((object)tExpando, tSetValueD);\n\n\n            Assert.AreEqual(tSetValueD, tExpando.Prop1);\n\n            var tPoco = new PropPoco();\n            var tSetValue = \"1\";\n\n            tCachedInvoke.Invoke(tPoco, tSetValue);\n\n            Assert.AreEqual(tSetValue, tPoco.Prop1);\n\n            String tSetValue2 = null;\n\n            tCachedInvoke.Invoke(tPoco, tSetValue2);\n\n            Assert.AreEqual(tSetValue2, tPoco.Prop1);\n        }\n\n\n\n        [Test]\n        public void TestConvert()\n        {\n            var tEl = new XElement(\"Test\", \"45\");\n\n            var tCast = Dynamic.InvokeConvert(tEl, typeof(int), @explicit: true);\n\n            Assert.AreEqual(typeof(int), tCast.GetType());\n            Assert.AreEqual(45, tCast);\n        }\n\n        [Test]\n        public void TestConvertCacheable()\n        {\n            var tEl = new XElement(\"Test\", \"45\");\n\n            var tCacheInvoke = new CacheableInvocation(InvocationKind.Convert, convertType: typeof(int),\n                                                       convertExplicit: true);\n            var tCast = tCacheInvoke.Invoke(tEl);\n\n            Assert.AreEqual(typeof(int), tCast.GetType());\n            Assert.AreEqual(45, tCast);\n        }\n\n        [Test]\n        public void TestConstruct()\n        {\n            var tCast = Dynamic.InvokeConstructor(typeof(List<object>), new object[]\n                                                                              {\n                                                                                  new string[] {\"one\", \"two\", \"three\"}\n                                                                              });\n\n            Assert.AreEqual(\"two\", tCast[1]);\n        }\n\n\n        [Test]\n        public void TestCacheableConstruct()\n        {\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.Constructor, argCount: 1);\n\n            dynamic tCast = tCachedInvoke.Invoke(typeof(List<object>), new object[]\n                                                                              {\n                                                                                  new string[] {\"one\", \"two\", \"three\"}\n                                                                              });\n\n            Assert.AreEqual(\"two\", tCast[1]);\n        }\n\n        \n\n        [Test]\n        public void TestConstructOptional()\n        {\n            var argname = InvokeArg.Create;\n\n\n            PocoOptConstructor tCast = Dynamic.InvokeConstructor(typeof(PocoOptConstructor), argname(\"three\", \"3\"));\n\n            Assert.AreEqual(\"-1\", tCast.One);\n            Assert.AreEqual(\"-2\", tCast.Two);\n            Assert.AreEqual(\"3\", tCast.Three);\n        }\n\n        [Test]\n        public void TestCacheableConstructOptional()\n        {\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.Constructor, argCount: 1, argNames: new[] { \"three\" });\n\n            var tCast = (PocoOptConstructor)tCachedInvoke.Invoke(typeof(PocoOptConstructor), \"3\");\n\n            Assert.AreEqual(\"-1\", tCast.One);\n            Assert.AreEqual(\"-2\", tCast.Two);\n            Assert.AreEqual(\"3\", tCast.Three);\n        }\n\n        [Test]\n        public void TestOptionalArgumentActivationNoneAndCacheable()\n        {\n\n            Assert.Throws<MissingMethodException>(() => Activator.CreateInstance<DynamicObjects.List>());\n\n            var tList = Dynamic.InvokeConstructor(typeof(DynamicObjects.List));\n\n\n            Assert.AreEqual(typeof(DynamicObjects.List), tList.GetType());\n\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.Constructor);\n\n            var tList1 = tCachedInvoke.Invoke(typeof(DynamicObjects.List));\n\n\n            Assert.AreEqual(typeof(DynamicObjects.List), tList1.GetType());\n        }\n\n\n\n        [Test]\n        public void TestConstructValueType()\n        {\n            var tCast = Dynamic.InvokeConstructor(typeof(DateTime), 2009, 1, 20);\n\n            Assert.AreEqual(20, tCast.Day);\n\n        }\n\n        [Test]\n        public void TestCacheableConstructValueType()\n        {\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.Constructor, argCount: 3);\n            dynamic tCast = tCachedInvoke.Invoke(typeof(DateTime), 2009, 1, 20);\n\n            Assert.AreEqual(20, tCast.Day);\n\n        }\n\n        [Test]\n        public void TestConstructValueTypeJustDynamic()\n        {\n            dynamic day = 20;\n            dynamic year = 2009;\n            dynamic month = 1;\n            var tCast = new DateTime(year, month, day);\n            DateTime tDate = tCast;\n            Assert.AreEqual(20, tDate.Day);\n        }\n\n        [Test]\n        public void TestConstructprimativetype()\n        {\n            var tCast = Dynamic.InvokeConstructor(typeof(Int32));\n\n            Assert.AreEqual(default(Int32), tCast);\n        }\n\n\n        [Test]\n        public void TestConstructDateTimeNoParams()\n        {\n            var tCast = Dynamic.InvokeConstructor(typeof(DateTime));\n\n            Assert.AreEqual(default(DateTime), tCast);\n        }\n\n        [Test]\n        public void TestConstructOBjectNoParams()\n        {\n            var tCast = Dynamic.InvokeConstructor(typeof(object));\n\n            Assert.AreEqual(typeof(object), tCast.GetType());\n        }\n\n        [Test]\n        public void TestConstructNullableprimativetype()\n        {\n            var tCast = Dynamic.InvokeConstructor(typeof(Nullable<Int32>));\n\n            Assert.AreEqual(null, tCast);\n        }\n\n        [Test]\n        public void TestConstructGuid()\n        {\n            var tCast = Dynamic.InvokeConstructor(typeof(Guid));\n\n            Assert.AreEqual(default(Guid), tCast);\n        }\n\n        [Test]\n        public void TestCacheablePrimativeDateTimeObjectNullableAndGuidNoParams()\n        {\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.Constructor);\n\n            dynamic tCast = tCachedInvoke.Invoke(typeof(Int32));\n\n            Assert.AreEqual(default(Int32), tCast);\n\n            tCast = tCachedInvoke.Invoke(typeof(DateTime));\n\n            Assert.AreEqual(default(DateTime), tCast);\n\n            tCast = tCachedInvoke.Invoke(typeof(List<string>));\n\n            Assert.AreEqual(typeof(List<string>), tCast.GetType());\n\n            tCast = tCachedInvoke.Invoke(typeof(object));\n\n            Assert.AreEqual(typeof(object), tCast.GetType());\n\n            tCast = tCachedInvoke.Invoke(typeof(Nullable<Int32>));\n\n            Assert.AreEqual(null, tCast);\n\n            tCast = tCachedInvoke.Invoke(typeof(Guid));\n\n            Assert.AreEqual(default(Guid), tCast);\n        }\n\n\n        [Test]\n        public void TestStaticCall()\n        {\n            var @static = InvokeContext.CreateStatic;\n            var generic = InvokeMemberName.Create;\n\n            var tOut = Dynamic.InvokeMember(@static(typeof(StaticType)),\n                                              generic(\"Create\",new[]{typeof(bool)}), 1);\n            Assert.AreEqual(false, tOut);\n        }\n\n        [Test]\n        public void TestCacheableStaticCall()\n        {\n            var @static = InvokeContext.CreateStatic;\n            var generic = InvokeMemberName.Create;\n\n            var tCached = new CacheableInvocation(InvocationKind.InvokeMember, generic(\"Create\",new[]{typeof(bool)}) , argCount: 1,\n                                    context: @static(typeof(StaticType)));\n\n            var tOut = tCached.Invoke(typeof(StaticType), 1);\n            Assert.AreEqual(false, tOut);\n        }\n        \n        private class TestClass\n        {\n            public static int StaticProperty { get; set; }\n        }\n\n        [Test]\n        public void TestStaticPropertySetFollowedByGetTest()\n        {\n            var staticContext = InvokeContext.CreateStatic;\n            Dynamic.InvokeSet(staticContext(typeof(TestClass)), \"StaticProperty\", 42);\n            var tOut = Dynamic.InvokeGet(staticContext(typeof(TestClass)), \"StaticProperty\");\n            Assert.AreEqual(42, tOut);\n        }\n        \n     \n        [Test]\n        public void TestImplicitConvert()\n        {\n            var tEl = 45;\n\n            var tCast = Dynamic.InvokeConvert(tEl, typeof(long));\n\n            Assert.AreEqual(typeof(long), tCast.GetType());\n        }\n\n        [Test]\n        public void TestCoerceConverterColor()\n        {\n            var colorString = \"PaleVioletRed\";\n\n            var color =Dynamic.CoerceConvert(colorString, typeof (Color));\n\n            Assert.That((object)color,Is.TypeOf<Color>());\n            Assert.That((object)color, Is.EqualTo(Color.PaleVioletRed));\n\n        }\n\n        [Test]\n        public void TestCoerceConverterDBNULL()\n        {\n            var tEl = DBNull.Value;\n\n            var tCast = Dynamic.CoerceConvert(tEl, typeof(long));\n\n            Assert.AreEqual(typeof(long), tCast.GetType());\n\n            var tCast2 = Dynamic.CoerceConvert(tEl, typeof(string));\n            Assert.AreEqual(null, tCast2);\n\n            Assert.AreNotEqual(null, tEl);\n        }\n\n\n\n        [Test]\n        public void TestCacheableImplicitConvert()\n        {\n            var tEl = 45;\n\n            var tCachedInvoke = CacheableInvocation.CreateConvert(typeof(long));\n\n            var tCast = tCachedInvoke.Invoke(tEl);\n\n            Assert.AreEqual(typeof(long), tCast.GetType());\n        }\n\n\n        [Test]\n        public void TestCacheableGet()\n        {\n            var tCached = new CacheableInvocation(InvocationKind.Get, \"Prop1\");\n\n            var tSetValue = \"1\";\n            var tAnon = new PropPoco { Prop1 = tSetValue };\n\n            var tOut = tCached.Invoke(tAnon);\n            Assert.AreEqual(tSetValue, tOut);\n\n            var tSetValue2 = \"2\";\n            tAnon = new PropPoco { Prop1 = tSetValue2 };\n\n\n            var tOut2 = tCached.Invoke(tAnon);\n\n\n            Assert.AreEqual(tSetValue2, tOut2);\n\n        }\n\n        [Test]\n        public void TestGetIndexer()\n        {\n\n            dynamic tSetValue = \"1\";\n            var tAnon = new[] { tSetValue, \"2\" };\n\n\n            string tOut = Dynamic.InvokeGetIndex(tAnon, 0);\n\n            Assert.AreEqual(tSetValue, tOut);\n\n        }\n\n\n        [Test]\n        public void TestGetIndexerValue()\n        {\n\n\n            var tAnon = new int[] { 1, 2 };\n\n\n            int tOut = Dynamic.InvokeGetIndex(tAnon, 1);\n\n            Assert.AreEqual(tAnon[1], tOut);\n\n        }\n\n\n        [Test]\n        public void TestGetLengthArray()\n        {\n            var tAnon = new[] { \"1\", \"2\" };\n\n\n            int tOut = Dynamic.InvokeGet(tAnon, \"Length\");\n\n            Assert.AreEqual(2, tOut);\n\n        }\n\n        [Test]\n        public void TestGetIndexerArray()\n        {\n            dynamic tSetValue = \"1\";\n            var tAnon = new List<string> { tSetValue, \"2\" };\n\n\n            string tOut = Dynamic.InvokeGetIndex(tAnon, 0);\n\n            Assert.AreEqual(tSetValue, tOut);\n\n        }\n\n\n        [Test]\n        public void TestCacheableIndexer()\n        {\n\n            var tStrings = new[] { \"1\", \"2\" };\n\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.GetIndex, argCount: 1);\n\n            var tOut = (string)tCachedInvoke.Invoke(tStrings, 0);\n\n            Assert.AreEqual(tStrings[0], tOut);\n\n            var tOut2 = (string)tCachedInvoke.Invoke(tStrings, 1);\n\n            Assert.AreEqual(tStrings[1], tOut2);\n\n            var tInts = new int[] { 3, 4 };\n\n            var tOut3 = (int)tCachedInvoke.Invoke(tInts, 0);\n\n            Assert.AreEqual(tInts[0], tOut3);\n\n            var tOut4 = (int)tCachedInvoke.Invoke(tInts, 1);\n\n            Assert.AreEqual(tInts[1], tOut4);\n\n            var tList = new List<string> { \"5\", \"6\" };\n\n            var tOut5 = (string)tCachedInvoke.Invoke(tList, 0);\n\n            Assert.AreEqual(tList[0], tOut5);\n\n            var tOut6 = (string)tCachedInvoke.Invoke(tList, 0);\n\n            Assert.AreEqual(tList[0], tOut6);\n        }\n\n        [Test]\n        public void TestSetIndexer()\n        {\n\n            dynamic tSetValue = \"3\";\n            var tAnon = new List<string> { \"1\", \"2\" };\n\n            Dynamic.InvokeSetIndex(tAnon, 0, tSetValue);\n\n            Assert.AreEqual(tSetValue, tAnon[0]);\n\n        }\n\n        [Test]\n        public void TestCacheableSetIndexer()\n        {\n\n            dynamic tSetValue = \"3\";\n            var tList = new List<string> { \"1\", \"2\" };\n\n\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.SetIndex, argCount: 2);\n\n            tCachedInvoke.Invoke(tList, 0, tSetValue);\n\n            Assert.AreEqual(tSetValue, tList[0]);\n\n        }\n\n\n\n        [Test]\n        public void TestMethodDynamicPassAndGetValue()\n        {\n            dynamic tExpando = new ExpandoObject();\n            tExpando.Func = new Func<int, string>(it => it.ToString());\n\n            var tValue = 1;\n\n            var tOut = Dynamic.InvokeMember(tExpando, \"Func\", tValue);\n\n            Assert.AreEqual(tValue.ToString(), tOut);\n        }\n\n\n        [Test]\n        public void TestCacheableMethodDynamicPassAndGetValue()\n        {\n            dynamic tExpando = new ExpandoObject();\n            tExpando.Func = new Func<int, string>(it => it.ToString());\n\n            var tValue = 1;\n\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.InvokeMember, \"Func\", 1);\n\n            var tOut = tCachedInvoke.Invoke((object)tExpando, tValue);\n\n            Assert.AreEqual(tValue.ToString(), tOut);\n        }\n\n\n        [Test]\n        public void TestMethodStaticOverloadingPassAndGetValue()\n        {\n            var tPoco = new OverloadingMethPoco();\n\n            var tValue = 1;\n\n            var tOut = Dynamic.InvokeMember(tPoco, \"Func\", tValue);\n\n            Assert.AreEqual(\"int\", tOut);\n\n            Assert.AreEqual(\"int\", (object)tOut); //should still be int because this uses runtime type\n\n\n            var tOut2 = Dynamic.InvokeMember(tPoco, \"Func\", 1m);\n\n            Assert.AreEqual(\"object\", tOut2);\n\n            var tOut3 = Dynamic.InvokeMember(tPoco, \"Func\", new { Anon = 1 });\n\n            Assert.AreEqual(\"object\", tOut3);\n        }\n\n        [Test]\n        public void TestCachedMethodStaticOverloadingPassAndGetValue()\n        {\n            var tPoco = new OverloadingMethPoco();\n\n            var tValue = 1;\n\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.InvokeMember, \"Func\", argCount: 1);\n\n\n            var tOut = tCachedInvoke.Invoke(tPoco, tValue);\n\n            Assert.AreEqual(\"int\", tOut);\n\n            Assert.AreEqual(\"int\", (object)tOut); //should still be int because this uses runtime type\n\n\n            var tOut2 = tCachedInvoke.Invoke(tPoco, 1m);\n\n            Assert.AreEqual(\"object\", tOut2);\n\n            var tOut3 = tCachedInvoke.Invoke(tPoco, new { Anon = 1 });\n\n            Assert.AreEqual(\"object\", tOut3);\n        }\n\n        [Test]\n        public void TestMethodPocoOverloadingPassAndGetValueArg()\n        {\n            var tPoco = new OverloadingMethPoco();\n\n            var tValue = 1;\n\n            var tOut = Dynamic.InvokeMember(tPoco, \"Func\", new InvokeArg(\"arg\", tValue));\n\n            Assert.AreEqual(\"int\", tOut);\n\n            Assert.AreEqual(\"int\", (object)tOut); //should still be int because this uses runtime type\n\n\n            var tOut2 = Dynamic.InvokeMember(tPoco, \"Func\", 1m);\n\n            Assert.AreEqual(\"object\", tOut2);\n\n            var tOut3 = Dynamic.InvokeMember(tPoco, \"Func\", new { Anon = 1 });\n\n            Assert.AreEqual(\"object\", tOut3);\n        }\n\n        [Test]\n        public void TestMethodPocoOverloadingPassAndGetValueArgOptional()\n        {\n            var tPoco = new OverloadingMethPoco();\n\n            var tValue = 1;\n\n            var arg = InvokeArg.Create;\n\n            var tOut = Dynamic.InvokeMember(tPoco, \"Func\", arg(\"two\", tValue));\n\n            Assert.AreEqual(\"object named\", tOut);\n\n            Assert.AreEqual(\"object named\", (object)tOut);\n        }\n\n        [Test]\n        public void TestCacheableMethodPocoOverloadingPassAndGetValueArgOptional()\n        {\n            var tPoco = new OverloadingMethPoco();\n\n            var tValue = 1;\n\n            var tCachedIvnocation = new CacheableInvocation(InvocationKind.InvokeMember, \"Func\", argCount: 1,\n                                                            argNames: new[] { \"two\" });\n\n            var tOut = tCachedIvnocation.Invoke(tPoco, tValue);\n\n            Assert.AreEqual(\"object named\", tOut);\n\n            Assert.AreEqual(\"object named\", (object)tOut);\n        }\n\n        [Test]\n        public void TestCacheableMethodPocoOverloadingPassAndGetValueArgPostiionalOptional()\n        {\n            var tPoco = new OverloadingMethPoco();\n\n            var tValue1 = 1;\n            var tValue2 = 2;\n\n            var tCachedIvnocation = new CacheableInvocation(InvocationKind.InvokeMember, \"Func\", argCount: 2,\n                                                            argNames: new[] { \"two\" });\n\n            var tOut = tCachedIvnocation.Invoke(tPoco, tValue1, tValue2);\n\n            Assert.AreEqual(\"object named\", tOut);\n\n            Assert.AreEqual(\"object named\", (object)tOut);\n        }\n\n        [Test]\n        public void TestMethodPocoOverloadingPass2AndGetValueArgOptional()\n        {\n            var tPoco = new OverloadingMethPoco();\n\n            var tValue = 1;\n\n            var arg = InvokeArg.Create;\n\n            var tOut = Dynamic.InvokeMember(tPoco, \"Func\", arg(\"two\", tValue), arg(\"one\", tValue));\n\n            Assert.AreEqual(\"object named\", tOut);\n\n            Assert.AreEqual(\"object named\", (object)tOut);\n        }\n\n        [Test]\n        public void TestMethodPocoOverloadingPassAndGetValueNull()\n        {\n            var tPoco = new OverloadingMethPoco();\n\n            var tValue = 1;\n\n            var tOut = Dynamic.InvokeMember(tPoco, \"Func\", tValue);\n\n            Assert.AreEqual(\"int\", tOut);\n\n            Assert.AreEqual(\"int\", (object)tOut); //should still be int because this uses runtime type\n\n\n            var tOut2 = Dynamic.InvokeMember(tPoco, \"Func\", 1m);\n\n            Assert.AreEqual(\"object\", tOut2);\n\n            var tOut3 = Dynamic.InvokeMember(tPoco, \"Func\", null);\n\n            Assert.AreEqual(\"object\", tOut3);\n\n            var tOut4 = Dynamic.InvokeMember(tPoco, \"Func\", null, null, \"test\", null, null, null);\n\n            Assert.AreEqual(\"object 6\", tOut4);\n\n            var tOut5 = Dynamic.InvokeMember(tPoco, \"Func\", null, null, null, null, null, null);\n\n            Assert.AreEqual(\"object 6\", tOut5);\n        }\n\n        /// <summary>\n        /// To dynamically invoke a method with out or ref parameters you need to know the signature\n        /// </summary>\n        [Test]\n        public void TestOutMethod()\n        {\n\n\n\n            string tResult = String.Empty;\n\n            var tPoco = new MethOutPoco();\n\n\n            var tName = \"Func\";\n            var tContext = GetType();\n            var tBinder =\n                Binder.InvokeMember(CSharpBinderFlags.None, tName, null, tContext,\n                                            new[]\n                                                {\n                                                    CSharpArgumentInfo.Create(\n                                                        CSharpArgumentInfoFlags.None, null),\n                                                    CSharpArgumentInfo.Create(\n                                                        CSharpArgumentInfoFlags.IsOut |\n                                                        CSharpArgumentInfoFlags.UseCompileTimeType, null)\n                                                });\n\n\n            var tSite = Dynamic.CreateCallSite<DynamicTryString>(tBinder, tName, tContext);\n\n\n            tSite.Target.Invoke(tSite, tPoco, out tResult);\n\n            Assert.AreEqual(\"success\", tResult);\n\n        }\n\n\n        [Test]\n        public void TestMethodDynamicPassVoid()\n        {\n            var tTest = \"Wrong\";\n\n            var tValue = \"Correct\";\n\n            dynamic tExpando = new ExpandoObject();\n            tExpando.Action = new Action<string>(it => tTest = it);\n\n\n\n            Dynamic.InvokeMemberAction(tExpando, \"Action\", tValue);\n\n            Assert.AreEqual(tValue, tTest);\n        }\n\n        [Test]\n        public void TestCacheableMethodDynamicPassVoid()\n        {\n            var tTest = \"Wrong\";\n\n            var tValue = \"Correct\";\n\n            dynamic tExpando = new ExpandoObject();\n            tExpando.Action = new Action<string>(it => tTest = it);\n\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.InvokeMemberAction, \"Action\", argCount: 1);\n\n            tCachedInvoke.Invoke((object)tExpando, tValue);\n\n            Assert.AreEqual(tValue, tTest);\n        }\n\n        [Test]\n        public void TestCacheableMethodDynamicUnknowns()\n        {\n            var tTest = \"Wrong\";\n\n            var tValue = \"Correct\";\n\n            dynamic tExpando = new ExpandoObject();\n            tExpando.Action = new Action<string>(it => tTest = it);\n            tExpando.Func = new Func<string, string>(it => it);\n\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.InvokeMemberUnknown, \"Action\", argCount: 1);\n\n            tCachedInvoke.Invoke((object)tExpando, tValue);\n\n            Assert.AreEqual(tValue, tTest);\n\n            var tCachedInvoke2 = new CacheableInvocation(InvocationKind.InvokeMemberUnknown, \"Func\", argCount: 1);\n\n            var Test2 = tCachedInvoke2.Invoke((object)tExpando, tValue);\n\n            Assert.AreEqual(tValue, Test2);\n        }\n\n\n\n        [Test]\n        public void TestMethodPocoGetValue()\n        {\n\n\n            var tValue = 1;\n\n            var tOut = Dynamic.InvokeMember(tValue, \"ToString\");\n\n            Assert.AreEqual(tValue.ToString(), tOut);\n        }\n\n\n\n        [Test]\n        public void TestMethodPocoPassAndGetValue()\n        {\n\n\n            HelpTestPocoPassAndGetValue(\"Test\", \"Te\");\n\n\n            HelpTestPocoPassAndGetValue(\"Test\", \"st\");\n        }\n\n        private void HelpTestPocoPassAndGetValue(string tValue, string tParam)\n        {\n            var tExpected = tValue.StartsWith(tParam);\n\n            var tOut = Dynamic.InvokeMember(tValue, \"StartsWith\", tParam);\n\n            Assert.AreEqual(tExpected, tOut);\n        }\n\n\n        [Test]\n        public void TestGetDynamic()\n        {\n\n            var tSetValue = \"1\";\n            dynamic tExpando = new ExpandoObject();\n            tExpando.Test = tSetValue;\n\n\n\n            var tOut = Dynamic.InvokeGet(tExpando, \"Test\");\n\n            Assert.AreEqual(tSetValue, tOut);\n        }\n\n        [Test]\n        public void TestGetDynamicChained()\n        {\n\n            var tSetValue = \"1\";\n            dynamic tExpando = new ExpandoObject();\n            tExpando.Test = new ExpandoObject();\n            tExpando.Test.Test2 = new ExpandoObject();\n            tExpando.Test.Test2.Test3 = tSetValue;\n\n\n            var tOut = Dynamic.InvokeGetChain(tExpando, \"Test.Test2.Test3\");\n\n            Assert.AreEqual(tSetValue, tOut);\n        }\n\n        [Test]\n        public void TestGetDynamicChainedWithIndexes()\n        {\n\n            var tSetValue = \"1\";\n            dynamic tExpando = Build.NewObject(\n                Test: Build.NewObject(\n                        Test2: Build.NewList(\n                        Build.NewObject(Test3: Build.NewObject(Test4: tSetValue))\n                        )\n                    )\n                );\n\n\n\n            var tOut = Dynamic.InvokeGetChain(tExpando, \"Test.Test2[0].Test3['Test4']\");\n\n            Assert.AreEqual(tSetValue, tOut);\n        }\n\n\n        [Test]\n        public void TestSetDynamicChained()\n        {\n\n            var tSetValue = \"1\";\n            dynamic tExpando = new ExpandoObject();\n            tExpando.Test = new ExpandoObject();\n            tExpando.Test.Test2 = new ExpandoObject();\n\n\n            Dynamic.InvokeSetChain(tExpando, \"Test.Test2.Test3\", tSetValue);\n\n            Assert.AreEqual(tSetValue, tExpando.Test.Test2.Test3);\n        }\n\n        [Test]\n        public void TestSetDynamicChainedWithInexes()\n        {\n            var tSetValue = \"1\";\n            dynamic tExpando = Build.NewObject(\n                Test: Build.NewObject(\n                        Test2: Build.NewList(\n                        Build.NewObject(Test3: Build.NewObject())\n                        )\n                    )\n                );\n\n\n            var tOut = Dynamic.InvokeSetChain(tExpando, \"Test.Test2[0].Test3['Test4']\", tSetValue);\n\n            Assert.AreEqual(tSetValue, tExpando.Test.Test2[0].Test3[\"Test4\"]);\n\n            Assert.AreEqual(tSetValue, tOut);\n        }\n\n        [Test]\n        public void TestSetDynamicAllDict()\n        {\n\n            var tSetValue = \"1\";\n            dynamic tExpando = new ExpandoObject();\n            tExpando.Test = new ExpandoObject();\n            tExpando.Test.Test2 = new ExpandoObject();\n\n\n            Dynamic.InvokeSetAll(tExpando, new Dictionary<string, object> { { \"Test.Test2.Test3\", tSetValue }, { \"One\", 1 }, { \"Two\", 2 } });\n\n            Dynamic.InvokeSetChain(tExpando, \"Test.Test2.Test3\", tSetValue);\n\n            Assert.AreEqual(tSetValue, tExpando.Test.Test2.Test3);\n            Assert.AreEqual(1, tExpando.One);\n            Assert.AreEqual(2, tExpando.Two);\n        }\n\n        [Test]\n        public void TestSetDynamicAllAnonymous()\n        {\n            dynamic tExpando = new ExpandoObject();\n\n            Dynamic.InvokeSetAll(tExpando, new { One = 1, Two = 2, Three = 3 });\n\n\n            Assert.AreEqual(1, tExpando.One);\n            Assert.AreEqual(2, tExpando.Two);\n            Assert.AreEqual(3, tExpando.Three);\n        }\n\n        [Test]\n        public void TestSetDynamicAllNamed()\n        {\n            dynamic tExpando = new ExpandoObject();\n\n            Dynamic.InvokeSetAll(tExpando, One: 1, Two: 2, Three: 3);\n\n\n            Assert.AreEqual(1, tExpando.One);\n            Assert.AreEqual(2, tExpando.Two);\n            Assert.AreEqual(3, tExpando.Three);\n        }\n\n        [Test]\n        public void TestSetDynamicChainedOne()\n        {\n\n            var tSetValue = \"1\";\n            dynamic tExpando = new ExpandoObject();\n\n\n            Dynamic.InvokeSetChain(tExpando, \"Test\", tSetValue);\n\n            Assert.AreEqual(tSetValue, tExpando.Test);\n        }\n\n        [Test]\n        public void TestGetDynamicChainedOne()\n        {\n\n            var tSetValue = \"1\";\n            dynamic tExpando = new ExpandoObject();\n            tExpando.Test = tSetValue;\n\n\n\n            var tOut = Dynamic.InvokeGetChain(tExpando, \"Test\");\n\n            Assert.AreEqual(tSetValue, tOut);\n        }\n\n        [Test]\n        public void TestCacheableGetDynamic()\n        {\n\n            var tSetValue = \"1\";\n            dynamic tExpando = new ExpandoObject();\n            tExpando.Test = tSetValue;\n\n            var tCached = new CacheableInvocation(InvocationKind.Get, \"Test\");\n\n            var tOut = tCached.Invoke((object)tExpando);\n\n            Assert.AreEqual(tSetValue, tOut);\n        }\n\n        [Test]\n        public void TestStaticGet()\n        {\n            var @static = InvokeContext.CreateStatic;\n            var tDate = Dynamic.InvokeGet(@static(typeof(DateTime)), \"Today\");\n            Assert.AreEqual(DateTime.Today, tDate);\n        }\n\n        [Test]\n        public void TestCacheableStaticGet()\n        {\n            var @static = InvokeContext.CreateStatic;\n            var tCached = new CacheableInvocation(InvocationKind.Get, \"Today\", context: @static(typeof(DateTime)));\n\n            var tDate = tCached.Invoke(typeof(DateTime));\n            Assert.AreEqual(DateTime.Today, tDate);\n        }\n\n\n        [Test]\n        public void TestStaticGet2()\n        {\n            var @static = InvokeContext.CreateStatic;\n            var tVal = Dynamic.InvokeGet(@static(typeof(StaticType)), \"Test\");\n            Assert.AreEqual(true, tVal);\n        }\n\n        [Test]\n        public void TestStaticGet3()\n        {\n            var tVal = Dynamic.InvokeGet((StaticContext)typeof(StaticType), \"Test\");\n            Assert.AreEqual(true, tVal);\n        }\n        [Test]\n        public void TestStaticSet()\n        {\n            var @static = InvokeContext.CreateStatic;\n            int tValue = 12;\n            Dynamic.InvokeSet(@static(typeof(StaticType)), \"TestSet\", tValue);\n            Assert.AreEqual(tValue, StaticType.TestSet);\n        }\n\n        [Test]\n        public void TestCacheableStaticSet()\n        {\n            int tValue = 12;\n            var @static = InvokeContext.CreateStatic;\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.Set, \"TestSet\",\n                                                        context: @static(typeof(StaticType)));\n            tCachedInvoke.Invoke(typeof(StaticType), tValue);\n            Assert.AreEqual(tValue, StaticType.TestSet);\n        }\n\n        [Test]\n        public void TestStaticDateTimeMethod()\n        {\n            var @static = InvokeContext.CreateStatic;\n            object tDateDyn = \"01/20/2009\";\n            var tDate = Dynamic.InvokeMember(@static(typeof(DateTime)), \"Parse\", tDateDyn, CultureInfo.GetCultureInfo(\"en-US\"));\n            Assert.AreEqual(new DateTime(2009, 1, 20), tDate);\n        }\n\n        [Test]\n        public void TestCacheableStaticDateTimeMethod()\n        {\n            var @static = InvokeContext.CreateStatic;\n            object tDateDyn = \"01/20/2009\";\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.InvokeMember, \"Parse\", 2,\n                                                        context: @static(typeof(DateTime)));\n            var tDate = tCachedInvoke.Invoke(typeof(DateTime), tDateDyn,CultureInfo.GetCultureInfo(\"en-US\"));\n            Assert.AreEqual(new DateTime(2009, 1, 20), tDate);\n        }\n\n\n\n        [Test]\n        public void TestIsEvent()\n        {\n            dynamic tPoco = new PocoEvent();\n\n            var tResult = Dynamic.InvokeIsEvent(tPoco, \"Event\");\n\n            Assert.AreEqual(true, tResult);\n        }\n\n        [Test]\n        public void TestCacheableIsEventAndIsNotEvent()\n        {\n            object tPoco = new PocoEvent();\n\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.IsEvent, \"Event\");\n\n            var tResult = tCachedInvoke.Invoke(tPoco);\n\n            Assert.AreEqual(true, tResult);\n\n            dynamic tDynamic = new DynamicObjects.Dictionary();\n\n            tDynamic.Event = null;\n\n            var tResult2 = tCachedInvoke.Invoke((object)tDynamic);\n\n            Assert.AreEqual(false, tResult2);\n        }\n\n        [Test]\n        public void TestIsNotEvent()\n        {\n            dynamic tDynamic = new DynamicObjects.Dictionary();\n\n            tDynamic.Event = null;\n\n            var tResult = Dynamic.InvokeIsEvent(tDynamic, \"Event\");\n\n            Assert.AreEqual(false, tResult);\n\n            bool tTest = false;\n            bool tTest2 = false;\n\n\n            tDynamic.Event += new EventHandler<EventArgs>((@object, args) => { tTest = true; });\n\n            tDynamic.Event += new EventHandler<EventArgs>((@object, args) => { tTest2 = true; });\n\n            Assert.AreEqual(false, tTest);\n\n            Assert.AreEqual(false, tTest2);\n\n            tDynamic.Event(null, null);\n\n            Assert.AreEqual(true, tTest);\n\n            Assert.AreEqual(true, tTest2);\n\n        }\n\n        [Test]\n        public void TestPocoAddAssign()\n        {\n            var tPoco = new PocoEvent();\n            bool tTest = false;\n\n            Dynamic.InvokeAddAssignMember(tPoco, \"Event\", new EventHandler<EventArgs>((@object, args) => { tTest = true; }));\n\n            tPoco.OnEvent(null, null);\n\n            Assert.AreEqual(true, tTest);\n\n            var tPoco2 = new PropPoco() { Prop2 = 3 };\n\n            Dynamic.InvokeAddAssignMember(tPoco2, \"Prop2\", 4);\n\n            Assert.AreEqual(7L, tPoco2.Prop2);\n        }\n\n        [Test]\n        public void TestCacheablePocoAddAssign()\n        {\n            var tPoco = new PocoEvent();\n            bool tTest = false;\n\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.AddAssign, \"Event\");\n\n            tCachedInvoke.Invoke(tPoco, new EventHandler<EventArgs>((@object, args) => { tTest = true; }));\n\n            tPoco.OnEvent(null, null);\n\n            Assert.AreEqual(true, tTest);\n\n            var tPoco2 = new PropPoco() { Event = 3 };\n\n            tCachedInvoke.Invoke(tPoco2, 4);\n\n            Assert.AreEqual(7L, tPoco2.Event);\n        }\n\n        [Test]\n        public void TestPocoSubtractAssign()\n        {\n            var tPoco = new PocoEvent();\n            bool tTest = false;\n            var tEvent = new EventHandler<EventArgs>((@object, args) => { tTest = true; });\n\n            tPoco.Event += tEvent;\n\n            Dynamic.InvokeSubtractAssignMember(tPoco, \"Event\", tEvent);\n\n            tPoco.OnEvent(null, null);\n\n            Assert.AreEqual(false, tTest);\n\n            Dynamic.InvokeSubtractAssignMember(tPoco, \"Event\", tEvent);//Test Second Time\n\n            var tPoco2 = new PropPoco() { Prop2 = 3 };\n\n            Dynamic.InvokeSubtractAssignMember(tPoco2, \"Prop2\", 4);\n\n            Assert.AreEqual(-1L, tPoco2.Prop2);\n        }\n\n        [Test]\n        public void TestCacheablePocoSubtractAssign()\n        {\n            var tPoco = new PocoEvent();\n            bool tTest = false;\n            var tEvent = new EventHandler<EventArgs>((@object, args) => { tTest = true; });\n\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.SubtractAssign, \"Event\");\n\n            tPoco.Event += tEvent;\n\n            tCachedInvoke.Invoke(tPoco, tEvent);\n\n            tPoco.OnEvent(null, null);\n\n            Assert.AreEqual(false, tTest);\n\n            tCachedInvoke.Invoke(tPoco, tEvent);//Test Second Time\n\n            var tPoco2 = new PropPoco() { Event = 3 };\n\n            tCachedInvoke.Invoke(tPoco2, 4);\n\n            Assert.AreEqual(-1, tPoco2.Event);\n        }\n\n        [Test]\n        public void TestDynamicAddAssign()\n        {\n            var tDyanmic = Build.NewObject(Prop2: 3, Event: null, OnEvent: new ThisAction<object, EventArgs>((@this, obj, args) => @this.Event(obj, args)));\n            bool tTest = false;\n\n            Dynamic.InvokeAddAssignMember(tDyanmic, \"Event\", new EventHandler<EventArgs>((@object, args) => { tTest = true; }));\n\n            tDyanmic.OnEvent(null, null);\n\n            Assert.AreEqual(true, tTest);\n\n            Dynamic.InvokeAddAssignMember(tDyanmic, \"Prop2\", 4);\n\n            Assert.AreEqual(7L, tDyanmic.Prop2);\n        }\n\n        [Test]\n        public void TestCacheableDynamicAddAssign()\n        {\n            var tDyanmic = Build.NewObject(Prop2: 3, Event: null, OnEvent: new ThisAction<object, EventArgs>((@this, obj, args) => @this.Event(obj, args)));\n            var tDynamic2 = Build.NewObject(Event: 3);\n            bool tTest = false;\n\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.AddAssign, \"Event\");\n\n            tCachedInvoke.Invoke((object)tDyanmic, new EventHandler<EventArgs>((@object, args) => { tTest = true; }));\n\n            tDyanmic.OnEvent(null, null);\n\n            Assert.AreEqual(true, tTest);\n\n            tCachedInvoke.Invoke((object)tDynamic2, 4);\n\n            Assert.AreEqual(7, tDynamic2.Event);\n        }\n\n        [Test]\n        public void TestDynamicSubtractAssign()\n        {\n            var tDyanmic = Build.NewObject(Prop2: 3, Event: null, OnEvent: new ThisAction<object, EventArgs>((@this, obj, args) => @this.Event(obj, args)));\n            bool tTest = false;\n            var tEvent = new EventHandler<EventArgs>((@object, args) => { tTest = true; });\n\n            tDyanmic.Event += tEvent;\n\n            Dynamic.InvokeSubtractAssignMember(tDyanmic, \"Event\", tEvent);\n\n            tDyanmic.OnEvent(null, null);\n\n            Assert.AreEqual(false, tTest);\n\n\n            Dynamic.InvokeSubtractAssignMember(tDyanmic, \"Prop2\", 4);\n\n            Assert.AreEqual(-1L, tDyanmic.Prop2);\n        }\n\n\n        [Test]\n        public void TestCacheableDynamicSubtractAssign()\n        {\n            var tDyanmic = Build.NewObject(Prop2: 3, Event: null, OnEvent: new ThisAction<object, EventArgs>((@this, obj, args) => @this.Event(obj, args)));\n            var tDynamic2 = Build.NewObject(Event: 3);\n\n            bool tTest = false;\n            var tEvent = new EventHandler<EventArgs>((@object, args) => { tTest = true; });\n\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.SubtractAssign, \"Event\");\n\n            tDyanmic.Event += tEvent;\n\n            tCachedInvoke.Invoke((object)tDyanmic, tEvent);\n\n            tDyanmic.OnEvent(null, null);\n\n            Assert.AreEqual(false, tTest);\n\n\n            tCachedInvoke.Invoke((object)tDynamic2, 4);\n\n            Assert.AreEqual(-1, tDynamic2.Event);\n        }\n\n        [Test]\n        public void TestDynamicMemberNamesExpando()\n        {\n            ExpandoObject tExpando = Build<ExpandoObject>.NewObject(One: 1);\n\n            Assert.AreEqual(\"One\", Dynamic.GetMemberNames(tExpando, dynamicOnly: true).Single());\n        }\n\n        [Test]\n        public void TestDynamicMemberNamesImpromput()\n        {\n            DynamicObjects.Dictionary tDict = Build.NewObject(Two: 2);\n\n            Assert.AreEqual(\"Two\", Dynamic.GetMemberNames(tDict, dynamicOnly: true).Single());\n        }\n\n        [Test]\n        public void TestCachedInvocationEquality()\n        {\n            var tCachedIvnocation1 = new CacheableInvocation(InvocationKind.InvokeMember, \"Func\", argCount: 2,\n                                                            argNames: new[] { \"two\" });\n\n            var tCachedIvnocation2 = new CacheableInvocation(InvocationKind.InvokeMember, \"Func\", argCount: 2,\n                                                            argNames: new[] { \"two\" });\n\n            Assert.AreEqual(tCachedIvnocation1.GetHashCode(), tCachedIvnocation2.GetHashCode());\n            Assert.AreEqual(tCachedIvnocation1, tCachedIvnocation2);\n        }\n\n\n        private DynamicObject CreateMock(ExpressionType op)\n        {\n            var tMock = new Mock<DynamicObject>() { CallBase = true };\n            object result = It.IsAny<object>();\n            tMock.Setup(\n                s => s.TryBinaryOperation(It.Is<BinaryOperationBinder>(b => b.Operation == op), It.IsAny<object>(), out result)\n                ).Returns(true);\n            return tMock.Object;\n        }\n\n        public class OperatorTestDynObject:DynamicObject{\n            ExpressionType _type;\n            public OperatorTestDynObject(ExpressionType type){\n                _type = type;\n            }\n\n            public override bool TryBinaryOperation(BinaryOperationBinder binder, object arg, out object result){\n                Assert.AreEqual(_type, binder.Operation);\n                result = _type;\n                return true;\n            }\n\n            public override bool TryUnaryOperation(UnaryOperationBinder binder, out object result){\n                Assert.AreEqual(_type, binder.Operation);\n                result = _type;\n                return true;\n            }\n\n        }\n         private void RunBinaryMockTests(ExpressionType type){\n            var mock = new OperatorTestDynObject(type);\n            var dummy = new Object();\n            Dynamic.InvokeBinaryOperator(mock, type, dummy);\n        }\n\n        private void RunUnaryMockTests(ExpressionType type){\n            var mock = new OperatorTestDynObject(type);\n#pragma warning disable CS0618 // Type or member is obsolete\n            Dynamic.InvokeUnaryOpartor(type,mock);\n#pragma warning restore CS0618 // Type or member is obsolete\n        }\n\n        [Test]\n        public void TestInvokeAdd()\n        {\n            Assert.AreEqual(Dynamic.InvokeBinaryOperator(1, ExpressionType.Add, 2), 3);\n        }\n\n        [Test]\n        public void TestInvokeBasicUnaryOperatorsDynamic()\n        {\n            RunUnaryMockTests(ExpressionType.Not);\n            RunUnaryMockTests(ExpressionType.Negate);\n            RunUnaryMockTests(ExpressionType.Increment);\n            RunUnaryMockTests(ExpressionType.Decrement);\n        \n\n\n        }\n\n        [Test]\n        public void TestInvokeBasicBinaryOperatorsDynamic()\n        {\n            RunBinaryMockTests(ExpressionType.Add);\n            RunBinaryMockTests(ExpressionType.Subtract);\n            RunBinaryMockTests(ExpressionType.Divide);\n            RunBinaryMockTests(ExpressionType.Multiply);\n            RunBinaryMockTests(ExpressionType.Modulo);\n\n            RunBinaryMockTests(ExpressionType.And);\n            RunBinaryMockTests(ExpressionType.Or);\n            RunBinaryMockTests(ExpressionType.ExclusiveOr);\n            RunBinaryMockTests(ExpressionType.LeftShift);\n            RunBinaryMockTests(ExpressionType.RightShift);\n\n            RunBinaryMockTests(ExpressionType.AddAssign);\n            RunBinaryMockTests(ExpressionType.SubtractAssign);\n            RunBinaryMockTests(ExpressionType.DivideAssign);\n            RunBinaryMockTests(ExpressionType.MultiplyAssign);\n            RunBinaryMockTests(ExpressionType.ModuloAssign);\n\n            RunBinaryMockTests(ExpressionType.AndAssign);\n            RunBinaryMockTests(ExpressionType.OrAssign);\n            RunBinaryMockTests(ExpressionType.ExclusiveOrAssign);\n            RunBinaryMockTests(ExpressionType.LeftShiftAssign);\n            RunBinaryMockTests(ExpressionType.RightShiftAssign);\n        }\n\n\n        [Test]\n        public void TestInvokeSubtract()\n        {\n            Assert.AreEqual(Dynamic.InvokeBinaryOperator(1, ExpressionType.Subtract, 2), -1);\n        }\n\n    }\n}\n"
  },
  {
    "path": "Tests/Linq.cs",
    "content": "﻿using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Reflection;\nusing System.Text;\nusing System.Threading.Tasks;\nusing NUnit.Framework;\nusing IronPython.Hosting;\nusing Microsoft.Scripting;\n\nnamespace Dynamitey.Tests\n{\n    [TestFixture]\n    public class Linq : Helper\n    {\n  \n\n        [Test]\n        public void SimpleLinqDynamicLinq()\n        {\n\n            var expected = Enumerable.Range(1, 10).Where(i => i > 5).Skip(1).Take(2).Max();\n            var actual = Dynamic.Linq(Enumerable.Range(1, 10)).Where(new Func<int, bool>(i => i > 5)).Skip(1).Take(2).Max();\n\n            Assert.AreEqual(expected, actual);\n        }\n        [Test]\n        public void MoreGenericsDynamicLinq()\n        {\n            var expected = Enumerable.Range(1, 10).Select(i => Tuple.Create(1, i)).Aggregate(0, (accum, each) => each.Item2);\n            var actual = Dynamic.Linq(Enumerable.Range(1, 10))\n                .Select(new Func<int, Tuple<int, int>>(i => Tuple.Create(1, i)))\n                .Aggregate(0, new Func<int, Tuple<int, int>, int>((accum, each) => each.Item2));\n\n            Assert.AreEqual(expected, actual);\n\n        }\n\n        private dynamic RunPythonHelper(object linq, string code)\n        {\n            \n\n            var tEngine = Python.CreateEngine();\n            var tScope = tEngine.CreateScope();\n\n            tScope.SetVariable(\"linq\", linq);\n\n            var tSource = tEngine.CreateScriptSourceFromString(code.Trim(), SourceCodeKind.Statements);\n            var tCompiled = tSource.Compile();\n\n            tCompiled.Execute(tScope);\n            return tScope.GetVariable(\"result\");\n        }\n\n\n  \n\n        [Test]\n        public void PythonDynamicLinqGenericArgs()\n        {\n            var start = new Object[] { 1, \"string\", 4, Guid.Empty, 6 };\n            var expected = start.OfType<int>().Skip(1).First();\n            var actual = RunPythonHelper(Dynamic.Linq(start), @\"\nimport System\nresult = linq.OfType[System.Int32]().Skip(1).First()\n\n\");\n            Assert.AreEqual(expected, actual);\n        }\n\n\n        [Test]\n        public void PythonDynamicLinq()\n        {\n            var expected = Enumerable.Range(1, 10).Where(x => x < 5).OrderBy(x => 10 - x).First();\n\n\n            var actual = RunPythonHelper(Dynamic.Linq(Enumerable.Range(1, 10)),\n                                         @\"\nimport System\nresult = linq.Where.Overloads[System.Func[int, bool]](lambda x: x < 5).OrderBy(lambda x: 10-x).First()\n\n\");\n\n            Assert.AreEqual(expected, actual);\n        }\n\n\n        [Test]\n        public void PrintOutInterface()\n        {\n            var tList =\n                typeof(Enumerable).GetMethods(BindingFlags.Static | BindingFlags.Public).OrderBy(it => it.Name).\n                    ToList();\n\n            Console.WriteLine(\"public interface ILinq<TSource>:IEnumerable<TSource>\");\n            Console.WriteLine(\"{\");\n            foreach (var line in tList\n            .Where(it => it.GetParameters().Any()\n            && (HelperIsGenericExtension(it, typeof(IEnumerable<>))\n                || it.GetParameters().First().ParameterType == typeof(IEnumerable))\n            )\n            .Select(HelperMakeName))\n            {\n                Console.WriteLine(\"\\t\" + line);\n            }\n            Console.WriteLine(\"}\");\n            Console.WriteLine();\n\n            Console.WriteLine(\"public interface IOrderedLinq<TSource> : ILinq<TSource>, IOrderedEnumerable<TSource>\");\n            Console.WriteLine(\"{\");\n            foreach (var line in tList\n            .Where(it => it.GetParameters().Any()\n            && HelperIsGenericExtension(it, typeof(IOrderedEnumerable<>))\n            )\n            .Select(HelperMakeName))\n            {\n                Console.WriteLine(\"\\t\" + line);\n            }\n            Console.WriteLine(\"}\");\n            Console.WriteLine();\n\n            Console.WriteLine(\"//Skipped Methods\");\n            foreach (var line in tList\n            .Where(it => it.GetParameters().Any()\n            && !(HelperIsGenericExtension(it, typeof(IEnumerable<>)))\n            && !(HelperIsGenericExtension(it, typeof(IOrderedEnumerable<>)))\n            && !(it.GetParameters().First().ParameterType == typeof(IEnumerable)))\n            .Select(HelperMakeNameDebug))\n            {\n                Console.WriteLine(\"//\" + line);\n            }\n\n\n        }\n\n        private bool HelperIsGenericExtension(MethodInfo it, Type genericType)\n        {\n            return it.GetParameters().First().ParameterType.IsGenericType\n                   && it.GetParameters().First().ParameterType.GetGenericTypeDefinition() == genericType\n                   && HelperSignleGenericArgMatch(it.GetParameters().First().ParameterType.GetGenericArguments().Single());\n        }\n\n        bool HelperSignleGenericArgMatch(Type info)\n        {\n            foreach (var name in new[] { \"TSource\", \"TFirst\", \"TOuter\" })\n            {\n                if (info.Name == name)\n                {\n                    return true;\n                }\n            }\n\n            return false;\n        }\n\n\n        // Define other methods and classes here\n        string HelperFormatType(Type it)\n        {\n            if (HelperSignleGenericArgMatch(it))\n            {\n                return \"TSource\";\n            }\n\n            if (it.IsGenericType)\n            {\n                return String.Format(\"{0}<{1}>\", it.Name.Substring(0, it.Name.IndexOf(\"`\")), String.Join(\",\", it.GetGenericArguments().Select(a => HelperFormatType(a))));\n            }\n            else\n            {\n                return it.Name;\n            }\n        }\n\n        string HelperGenericParams(Type[] it)\n        {\n            var tArgs = it.Where(t => !HelperSignleGenericArgMatch(t)).Select(t => HelperFormatType(t));\n            if (!tArgs.Any())\n            {\n                return \"\";\n            }\n            return \"<\" + String.Join(\",\", tArgs) + \">\";\n        }\n        string HelperReturnTypeSub(Type it)\n        {\n            if (it.IsGenericType && (it.GetGenericTypeDefinition() == typeof(IEnumerable<>)))\n            {\n                return String.Format(\"ILinq<{0}>\", HelperFormatType(it.GetGenericArguments().Single()));\n            }\n            if (it.IsGenericType && (it.GetGenericTypeDefinition() == typeof(IOrderedEnumerable<>)))\n            {\n                return String.Format(\"IOrderedLinq<{0}>\", HelperFormatType(it.GetGenericArguments().Single()));\n            }\n            return HelperFormatType(it);\n\n        }\n\n        string HelperGetParams(ParameterInfo[] it)\n        {\n            var parms = it.Skip(1);\n            return String.Join(\",\", parms.Select(p => HelperFormatType(p.ParameterType) + \" \" + p.Name));\n\n        }\n\n        string HelperGetParamsDebug(ParameterInfo[] it)\n        {\n            var parms = it;\n            return String.Join(\",\", parms.Select(p => HelperFormatType(p.ParameterType) + \" \" + p.Name));\n\n        }\n\n        string HelperMakeName(MethodInfo it)\n        {\n            return String.Format(\"{0} {1}{2}({3});\", HelperReturnTypeSub(it.ReturnType), it.Name, HelperGenericParams(it.GetGenericArguments()), HelperGetParams(it.GetParameters()));\n        }\n        string HelperMakeNameDebug(MethodInfo it)\n        {\n            return String.Format(\"{0} {1}{2}({3});\", HelperReturnTypeSub(it.ReturnType), it.Name, HelperGenericParams(it.GetGenericArguments()), HelperGetParamsDebug(it.GetParameters()));\n        }\n    }\n}\n"
  },
  {
    "path": "Tests/MimicTest.cs",
    "content": "﻿using System;\nusing NUnit.Framework;\n\nnamespace Dynamitey.Tests\n{\n    /// <summary>\n    /// This is the craziest set of tests I've ever written in my life...\n    /// </summary>\n    [TestFixture]\n    public class MimicTest\n    {\n        private class SubMimic : DynamicObjects.Mimic\n        {\n            public int Add(int x, int y)\n            {\n                return x + y;\n            }\n\n            public string Add(string x, string y)\n            {\n                return x + y;\n            }\n        }\n\n        [Test]\n        public void Get_Property()\n        {\n            dynamic mimic = new DynamicObjects.Mimic();\n            dynamic result = mimic.I.Can.Get.Any.Property.I.Want.And.It.Wont.Blow.Up;\n            Assert.That((object)result, Is.TypeOf<DynamicObjects.Mimic>());\n        }\n\n        [Test]\n        public void Set_Property()\n        {\n            dynamic mimic = new DynamicObjects.Mimic();\n            dynamic result = mimic.I.Can.Set.Any.Property.I.Want.And.It.Wont.Blow = \"Up\";\n            Assert.That((object)result, Is.EqualTo(\"Up\"));\n        }\n\n        [Test]\n        public void Call_Method()\n        {\n            dynamic mimic = new DynamicObjects.Mimic();\n            dynamic result = mimic.I.Can.Call.Any.Method.I.Want.And.It.Wont.Blow.Up();\n            Assert.That((object)result, Is.TypeOf<DynamicObjects.Mimic>());\n        }\n\n        [Test]\n        public void Call_Method_With_Parameters()\n        {\n            dynamic mimic = new DynamicObjects.Mimic();\n            dynamic result = mimic.I().Can().Call().Any().Method().I().Want().And().It().Wont().Blow().Up(\"And\", \"Any\", \"Parameter\", \"I\", \"Want\", 1, 2, 3, 44.99m);\n            Assert.That((object)result, Is.TypeOf<DynamicObjects.Mimic>());\n        }\n\n        [Test]\n        public void Get_Index()\n        {\n            dynamic mimic = new DynamicObjects.Mimic();\n            dynamic result = mimic[\"I\"][\"Can\"][\"Get\"][\"Indexes\"][\"All\"][\"Day\"][\"Like\"][\"It\"][\"Aint\"][\"No\"][\"Thang\"];\n            Assert.That((object)result, Is.TypeOf<DynamicObjects.Mimic>());\n        }\n\n        [Test]\n        public void Set_Index()\n        {\n            dynamic mimic = new DynamicObjects.Mimic();\n            dynamic result = mimic[\"I\"][\"Can\"][\"Set\"][\"Indexes\"][\"All\"][\"Day\"][\"Like\"][\"It\"][\"Aint\"][\"No\"] = \"Thang\";\n            Assert.That((object)result, Is.EqualTo(\"Thang\"));\n        }\n\n        [Test]\n        public void Cast()\n        {\n            dynamic mimic = new DynamicObjects.Mimic();\n\n            int Int32 = mimic;\n            Assert.That(Int32,Is.EqualTo(0));\n            double Double = mimic;\n            Assert.That(Double, Is.EqualTo(0.0d));\n            float Float = mimic;\n            Assert.That(Float, Is.EqualTo(0.0f));\n            object Object = mimic;\n            Assert.That(Object,  Is.TypeOf<DynamicObjects.Mimic>());\n            Guid Guid = mimic;\n            Assert.That(Guid, Is.EqualTo(Guid.Empty));\n            DateTime DateTime = mimic;\n            Assert.That(DateTime, Is.EqualTo(default(DateTime)));\n        }\n\n        [Test]\n        public void Unary()\n        {\n            dynamic mimic = new DynamicObjects.Mimic();\n            dynamic result;\n\n            result = !mimic;\n            Assert.That((object)result, Is.TypeOf<DynamicObjects.Mimic>());\n            result = ++mimic;\n            Assert.That((object)result, Is.TypeOf<DynamicObjects.Mimic>());\n            result = --mimic;\n            Assert.That((object)result, Is.TypeOf<DynamicObjects.Mimic>());\n            result = mimic++;\n            Assert.That((object)result, Is.TypeOf<DynamicObjects.Mimic>());\n            result = mimic--;\n            Assert.That((object)result, Is.TypeOf<DynamicObjects.Mimic>());\n            result = mimic += 1;\n            Assert.That((object)result, Is.TypeOf<DynamicObjects.Mimic>());\n            result = mimic -= 1;\n            Assert.That((object)result, Is.TypeOf<DynamicObjects.Mimic>());\n            result = mimic /= 2;\n            Assert.That((object)result, Is.TypeOf<DynamicObjects.Mimic>());\n            result = mimic *= 4;\n            Assert.That((object)result, Is.TypeOf<DynamicObjects.Mimic>());\n            result = mimic ^= true;\n            Assert.That((object)result, Is.TypeOf<DynamicObjects.Mimic>());\n            result = mimic |= true;\n            Assert.That((object)result, Is.TypeOf<DynamicObjects.Mimic>());\n            result = mimic &= false;\n            Assert.That((object)result, Is.TypeOf<DynamicObjects.Mimic>());\n            result = mimic %= 5;\n            Assert.That((object)result, Is.TypeOf<DynamicObjects.Mimic>());\n        }\n\n        [Test]\n        public void Binary()\n        {\n            dynamic thing1 = new DynamicObjects.Mimic();\n            dynamic thing2 = new DynamicObjects.Mimic();\n            dynamic result;\n\n            result = thing1 + thing2;\n            Assert.That((object)result, Is.TypeOf<DynamicObjects.Mimic>());\n            result = thing1 - thing2;\n            Assert.That((object)result, Is.TypeOf<DynamicObjects.Mimic>());\n            result = thing1 / thing2;\n            Assert.That((object)result, Is.TypeOf<DynamicObjects.Mimic>());\n            result = thing1 * thing2;\n            Assert.That((object)result, Is.TypeOf<DynamicObjects.Mimic>());\n            result = thing1 | thing2;\n            Assert.That((object)result, Is.TypeOf<DynamicObjects.Mimic>());\n            result = thing1 & thing2;\n            Assert.That((object)result, Is.TypeOf<DynamicObjects.Mimic>());\n            result = thing1 ^ thing2;\n            Assert.That((object)result, Is.TypeOf<DynamicObjects.Mimic>());\n            result = thing1 % thing2;\n            Assert.That((object)result, Is.TypeOf<DynamicObjects.Mimic>());\n        }\n\n        [Test]\n        public void Inheritance_Int()\n        {\n            dynamic mimic = new SubMimic();\n            int result = mimic.Add(2, 2);\n            Assert.AreEqual(4, result);\n        }\n\n        [Test]\n        public void Inheritance_String()\n        {\n            dynamic mimic = new SubMimic();\n            string result = mimic.Add(\"He\", \"llo\");\n            Assert.AreEqual(\"Hello\", result);\n        }\n\n        [Test]\n        public void Inheritance_No_Match()\n        {\n            dynamic mimic = new SubMimic();\n            int result = mimic.Add(1, \"llo\");\n            Assert.AreEqual(default(int), result);\n        }\n    }\n}\n"
  },
  {
    "path": "Tests/PrivateTest.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Dynamitey.SupportLibrary;\nusing Microsoft.CSharp.RuntimeBinder;\nusing NUnit.Framework;\n\nnamespace Dynamitey.Tests\n{\n    [TestFixture]\n    public class PrivateTest : Helper\n    {\n  \n        [Test]\n        public void TestInvokePrivateMethod()\n        {\n            var tTest = new TestWithPrivateMethod();\n            Assert.That((object)Dynamic.InvokeMember(tTest, \"Test\"), Is.EqualTo(3));\n        }\n\n        [Test]\n        public void TestInvokePrivateMethodAcrossAssemblyBoundries()\n        {\n            var tTest = new PublicType();\n            Assert.That((object)Dynamic.InvokeMember(tTest, \"PrivateMethod\", 3), Is.True);\n        }\n\n        [Test]\n        public void TestInvokeInternalTypeMethodAcrossAssemblyBoundries()\n        {\n            var tTest = PublicType.InternalInstance;\n            Assert.That((object)Dynamic.InvokeMember(tTest, \"InternalMethod\", 3), Is.True);\n        }\n\n        [Test]\n        public void TestInvokeDoNotExposePrivateMethod()\n        {\n            var tTest = new TestWithPrivateMethod();\n            var context = InvokeContext.CreateContext;\n            Assert.That(() => Dynamic.InvokeMember(context(tTest,this), \"Test\"), Throws.InstanceOf<RuntimeBinderException>());\n        }\n\n        [Test]\n        public void TestCacheableDoNotExposePrivateMethod()\n        {\n            var tTest = new TestWithPrivateMethod();\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.InvokeMember, \"Test\");\n            Assert.That(() => tCachedInvoke.Invoke(tTest), Throws.InstanceOf<RuntimeBinderException>());\n        }\n\n        [Test]\n        public void TestCacheableExposePrivateMethodViaInstance()\n        {\n            var tTest = new TestWithPrivateMethod();\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.InvokeMember, \"Test\", context: tTest);\n            Assert.That(tCachedInvoke.Invoke(tTest), Is.EqualTo(3));\n        }\n\n        [Test]\n        public void TestCacheableExposePrivateMethodViaType()\n        {\n            var tTest = new TestWithPrivateMethod();\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.InvokeMember, \"Test\", context: typeof(TestWithPrivateMethod));\n            Assert.That( tCachedInvoke.Invoke(tTest), Is.EqualTo(3));\n        }\n    }\n\n    public class TestWithPrivateMethod\n    {\n        private int Test()\n        {\n            return 3;\n        }\n    }\n}\n"
  },
  {
    "path": "Tests/SpeedTest.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Dynamitey.SupportLibrary;\nusing NUnit.Framework;\nusing Microsoft.FSharp.Reflection;\n\nnamespace Dynamitey.Tests\n{\n    [TestFixture]\n    [Category(\"Performance\")]\n    public class SpeedTest:Helper\n    {\n        [OneTimeSetUp]\n        public void WarmUpDlr()\n        {\n            Dynamic.InvokeMember(1, \"ToString\");\n        }\n\n\n        public TimeIt Timer;\n        [SetUp]\n        public void Setup()\n        {\n            Timer = new TimeIt();\n        }\n\n\n        [Test]\n        public void PropPocoGetValueTimed()\n        {\n#if DEBUG\n            Assert.Ignore(\"Visual Studio slows down dynamic too much in debug mode\");\n#endif\n\n            var tSetValue = \"1\";\n            var tAnon = new { TestGet = tSetValue };\n\n\n\n            Timer.Action1 = () => { var tOut = Dynamic.InvokeGet(tAnon, \"TestGet\"); };\n\n            var tPropertyInfo = tAnon.GetType().GetProperty(\"TestGet\");\n            Timer.Action2 = () =>\n            {\n                var tOut = tPropertyInfo.GetValue(tAnon, null);\n            };\n\n            var elapsed = Timer.Go(5 * TimeIt.Million);\n\n            Console.WriteLine(\"Impromptu: \" + elapsed.Item1);\n            Console.WriteLine(\"Refelection: \" + elapsed.Item2);\n            Console.WriteLine(\"Impromptu VS Reflection: {0}\", TimeIt.RelativeSpeed(elapsed));\n            Assert.Less(elapsed.Item1, elapsed.Item2);\n        }\n\n\n        [Test]\n        public void CacheableGetValueTimed()\n        {\n            var tSetValue = \"1\";\n            var tAnon = new PropPoco() { Prop1 = tSetValue };\n\n\n            var tInvoke = new CacheableInvocation(InvocationKind.Get, \"Prop1\");\n            Timer.Action1 = () => { var tOut = tInvoke.Invoke(tAnon); };\n\n            var tPropertyInfo = tAnon.GetType().GetProperty(\"Prop1\");\n            Timer.Action2 = () =>\n                                {\n                                    var tOut = tPropertyInfo.GetValue(tAnon, null);\n                                };\n\n            var elapsed = Timer.Go(2*TimeIt.Million);\n\n\n            Console.WriteLine(\"Impromptu: \" + elapsed.Item1);\n            Console.WriteLine(\"Refelection: \" + elapsed.Item2);\n            Console.WriteLine(\"Impromptu VS Reflection: {0}\", TimeIt.RelativeSpeed(elapsed));\n            Assert.Less(elapsed.Item1, elapsed.Item2);\n        }\n\n\n\n        [Test]\n        public void ConstructorTimed()\n        {\n\n            Timer.Action1 = (() => { var tOut = Dynamic.InvokeConstructor(typeof(Tuple<string>), \"Test\"); });\n            Timer.Action2 = (() =>\n            {\n                var tOut = Activator.CreateInstance(typeof(Tuple<string>), \"Test\");\n            });\n\n            var elapsed = Timer.Go();\n\n\n            Console.WriteLine(\"Impromptu: \" + elapsed.Item1);\n            Console.WriteLine(\"Refelection: \" + elapsed.Item2);\n            Console.WriteLine(\"Impromptu VS Reflection: {0}\", TimeIt.RelativeSpeed(elapsed));\n            Assert.Less(elapsed.Item1, elapsed.Item2);\n        }\n        [Test]\n        public void CacheableConstructorTimed()\n        {\n\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.Constructor, argCount: 1);\n            Timer.Action1 = (() => { var tOut = tCachedInvoke.Invoke(typeof(Tuple<string>), \"Test\"); });\n            Timer.Action2 = (() =>\n            {\n                var tOut = Activator.CreateInstance(typeof(Tuple<string>), \"Test\");\n            });\n\n             var elapsed = Timer.Go();\n\n            Console.WriteLine(\"Impromptu: \" + elapsed.Item1);\n            Console.WriteLine(\"Refelection: \" + elapsed.Item2);\n            Console.WriteLine(\"Impromptu VS Reflection: {0}\", TimeIt.RelativeSpeed(elapsed));\n            Assert.Less(elapsed.Item1, elapsed.Item2);\n        }\n\n        [Test]\n        public void ConstructorNoARgTimed()\n        {\n            Timer.Action1=(() => { var tOut = Dynamic.InvokeConstructor(typeof(List<string>)); });\n            Timer.Action2=(() =>\n            {\n                var tOut = Activator.CreateInstance(typeof(List<string>));\n            });\n            Timer.Action3=(() =>\n            {\n                var tOut = Activator.CreateInstance<List<string>>();\n            });\n               \n            var elapsed = Timer.GoThree();\n\n            Console.WriteLine(\"Impromptu: \" + elapsed.Item1);\n            Console.WriteLine(\"Refelection: \" + elapsed.Item2);\n            Console.WriteLine(\"Refelection Generic: \" + elapsed.Item3);\n            Console.WriteLine(\"Impromptu VS Reflection: {0:0.0} x slower\", (double)elapsed.Item1.Ticks / elapsed.Item2.Ticks);\n\n            Assert.Ignore(\"I don't think this is beatable at the moment\");\n            Assert.Less(elapsed.Item1, elapsed.Item2);\n        }\n\n        [Test]\n        public void CachableConstructorNoARgTimed()\n        {\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.Constructor);\n            Timer.Action1=(() => { var tOut = tCachedInvoke.Invoke(typeof(List<string>)); });\n            Timer.Action2=(() =>\n            {\n                var tOut = Activator.CreateInstance(typeof(List<string>));\n            });\n            Timer.Action3=(() =>\n            {\n                var tOut = Activator.CreateInstance<List<string>>();\n            });\n                    \n            var elapsed = Timer.GoThree();\n\n            Console.WriteLine(\"Impromptu: \" + elapsed.Item1);\n            Console.WriteLine(\"Refelection: \" + elapsed.Item2);\n            Console.WriteLine(\"Refelection Generic: \" + elapsed.Item3);\n            Console.WriteLine(\"Impromptu VS Reflection: {0:0.0} x slower\", (double)elapsed.Item1.Ticks / elapsed.Item2.Ticks);\n\n            Assert.Ignore(\"I don't think this is beatable at the moment\");\n            Assert.Less(elapsed.Item1, elapsed.Item2);\n        }\n\n\n        [Test]\n        public void ConstructorValueTypeTimed()\n        {\n\n\n\n            Timer.Action1=(() => { var tOut = Dynamic.InvokeConstructor(typeof(DateTime), 2010, 1, 20); });\n            Timer.Action2=(() =>\n            {\n                var tOut = Activator.CreateInstance(typeof(DateTime), 2010, 1, 20);\n            });\n\n               \n            var elapsed = Timer.Go();\n\n            Console.WriteLine(\"Impromptu: \" + elapsed.Item1);\n            Console.WriteLine(\"Refelection: \" + elapsed.Item2);\n            Console.WriteLine(\"Impromptu VS Reflection: {0}\", TimeIt.RelativeSpeed(elapsed));\n            Assert.Less(elapsed.Item1, elapsed.Item2);\n        }\n\n        [Test]\n        public void CachedConstructorValueTypeTimed()\n        {\n\n\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.Constructor, argCount: 3);\n            Timer.Action1=(() => { var tOut = tCachedInvoke.Invoke(typeof(DateTime), 2010, 1, 20); });\n            Timer.Action2=(() =>\n            {\n                var tOut = Activator.CreateInstance(typeof(DateTime), 2010, 1, 20);\n            });\n\n              var elapsed = Timer.Go();\n\n            Console.WriteLine(\"Impromptu: \" + elapsed.Item1);\n            Console.WriteLine(\"Refelection: \" + elapsed.Item2);\n            Console.WriteLine(\"Impromptu VS Reflection: {0}\", TimeIt.RelativeSpeed(elapsed));\n            Assert.Less(elapsed.Item1, elapsed.Item2);\n        }\n\n\n        [Test]\n        public void MethodPocoGetValueTimed()\n        {\n#if DEBUG\n            Assert.Ignore(\"Visual Studio slows down dynamic too much in debug mode\");\n#endif\n\n            var tValue = 1;\n\n\n            Timer.Action1=(() => { var tOut = Dynamic.InvokeMember(tValue, \"ToString\"); });\n            var tMethodInfo = tValue.GetType().GetMethod(\"ToString\", new Type[] { });\n            Timer.Action2=(() =>\n            {\n                var tOut = tMethodInfo.Invoke(tValue, new object[] { });\n            });\n\n            var elapsed = Timer.Go(2* TimeIt.Million);\n\n            Console.WriteLine(\"Impromptu: \" + elapsed.Item1);\n            Console.WriteLine(\"Refelection: \" + elapsed.Item2);\n            Console.WriteLine(\"Impromptu VS Reflection: {0}\", TimeIt.RelativeSpeed(elapsed));\n            Assert.Less(elapsed.Item1, elapsed.Item2);\n        }\n\n        [Test]\n        public void CacheableMethodPocoGetValueTimed()\n        {\n\n\n            var tValue = 1;\n\n\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.InvokeMember, \"ToString\");\n            Timer.Action1=(() => { var tOut = tCachedInvoke.Invoke(tValue); });\n            var tMethodInfo = tValue.GetType().GetMethod(\"ToString\", new Type[] { });\n            Timer.Action2=(() =>\n            {\n                var tOut = tMethodInfo.Invoke(tValue, new object[] { });\n            });\n\n                  var elapsed = Timer.Go(3* TimeIt.Million);\n\n            Console.WriteLine(\"Impromptu: \" + elapsed.Item1);\n            Console.WriteLine(\"Refelection: \" + elapsed.Item2);\n            Console.WriteLine(\"Impromptu VS Reflection: {0}\", TimeIt.RelativeSpeed(elapsed));\n            Assert.Less(elapsed.Item1, elapsed.Item2);\n        }\n\n        [Test]\n        public void GetStaticTimed()\n        {\n\n#if DEBUG\n            Assert.Ignore(\"Visual Studio slows down dynamic too much in debug mode\");\n#endif\n\n\n            var tStaticType = typeof(DateTime);\n            var tTarget = InvokeContext.CreateStatic(tStaticType);\n            Timer.Action1=(() => { var tOut = Dynamic.InvokeGet(tTarget, \"Today\"); });\n            var tMethodInfo = typeof(DateTime).GetProperty(\"Today\").GetGetMethod();\n            Timer.Action2=(() =>\n            {\n                var tOut = tMethodInfo.Invoke(tStaticType, new object[] { });\n            });\n\n            var elapsed = Timer.Go(3 * TimeIt.Million);\n\n            Console.WriteLine(\"Impromptu: \" + elapsed.Item1);\n            Console.WriteLine(\"Refelection: \" + elapsed.Item2);\n            Console.WriteLine(\"Impromptu VS Reflection: {0}\", TimeIt.RelativeSpeed(elapsed));\n            Assert.Less(elapsed.Item1, elapsed.Item2);\n        }\n\n        [Test]\n        public void CacheableGetStaticTimed()\n        {\n\n            var tStaticType = typeof(DateTime);\n            var tContext = InvokeContext.CreateStatic(tStaticType);\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.Get, \"Today\", context: tContext);\n\n            Timer.Action1=(() =>\n            {\n                var tOut = tCachedInvoke.Invoke(tStaticType);\n            });\n            var tMethodInfo = typeof(DateTime).GetProperty(\"Today\").GetGetMethod();\n\n            Timer.Action2=(() =>\n            {\n                var tOut = tMethodInfo.Invoke(tStaticType, new object[] { });\n            });\n\n\n            var elapsed = Timer.Go(3 * TimeIt.Million);\n\n            Console.WriteLine(\"Impromptu: \" + elapsed.Item1);\n            Console.WriteLine(\"Refelection: \" + elapsed.Item2);\n            Console.WriteLine(\"Impromptu VS Reflection: {0}\", TimeIt.RelativeSpeed(elapsed));\n            Assert.Less(elapsed.Item1, elapsed.Item2);\n        }\n\n        [Test]\n        public void MethodStaticMethodValueTimed()\n        {\n#if DEBUG\n            Assert.Ignore(\"Visual Studio slows down dynamic too much in debug mode\");\n#endif\n            var tStaticType = typeof(DateTime);\n            var tTarget =  InvokeContext.CreateStatic(tStaticType);\n            string tDate = \"01/20/2009\";\n            Timer.Action1=(() => { var tOut = Dynamic.InvokeMember(tTarget, \"Parse\", tDate); });\n            var tMethodInfo = typeof(DateTime).GetMethod(\"Parse\", new[] { typeof(string) });\n            Timer.Action2=(() =>\n            {\n                var tOut = tMethodInfo.Invoke(tStaticType, new object[] { tDate });\n            });\n\n               var elapsed = Timer.Go();\n\n            Console.WriteLine(\"Impromptu: \" + elapsed.Item1);\n            Console.WriteLine(\"Refelection: \" + elapsed.Item2);\n            Console.WriteLine(\"Impromptu VS Reflection: {0}\", TimeIt.RelativeSpeed(elapsed));\n            Assert.Less(elapsed.Item1, elapsed.Item2);\n        }\n\n        [Test]\n        public void CacheableMethodStaticMethodValueTimed()\n        {\n\n            var tStaticType = typeof(DateTime);\n            var tContext =  InvokeContext.CreateStatic(tStaticType);\n            string tDate = \"01/20/2009\";\n\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.InvokeMember, \"Parse\", argCount: 1,\n                                                        context: tContext);\n            Timer.Action1=(() => { var tOut = tCachedInvoke.Invoke(tStaticType, tDate); });\n            var tMethodInfo = typeof(DateTime).GetMethod(\"Parse\", new[] { typeof(string) });\n            Timer.Action2=(() =>\n            {\n                var tOut = tMethodInfo.Invoke(tStaticType, new object[] { tDate });\n            });\n\n             var elapsed = Timer.Go();\n\n            Console.WriteLine(\"Impromptu: \" + elapsed.Item1);\n            Console.WriteLine(\"Refelection: \" + elapsed.Item2);\n            Console.WriteLine(\"Impromptu VS Reflection: {0}\", TimeIt.RelativeSpeed(elapsed));\n            Assert.Less(elapsed.Item1, elapsed.Item2);\n        }\n\n          [Test]\n        public void MethodPocoGetValuePassNullTimed()\n        {\n#if DEBUG\n            Assert.Ignore(\"Visual Studio slows down dynamic too much in debug mode\");\n#endif\n\n            var tValue = new OverloadingMethPoco();\n\n\n            Timer.Action1=(() => { var tOut = Dynamic.InvokeMember(tValue, \"Func\", null); });\n            var tMethodInfo = tValue.GetType().GetMethod(\"Func\", new Type[] { typeof(object)});\n            Timer.Action2=(() =>\n            {\n                var tOut = tMethodInfo.Invoke(tValue, new object[] { null});\n            });\n\n          \n             var elapsed = Timer.Go(3 * TimeIt.Million);\n\n            Console.WriteLine(\"Impromptu: \" + elapsed.Item1);\n            Console.WriteLine(\"Refelection: \" + elapsed.Item2);\n            Console.WriteLine(\"Impromptu VS Reflection: {0}\", TimeIt.RelativeSpeed(elapsed));\n            Assert.Less(elapsed.Item1, elapsed.Item2);\n        }\n\n        [Test]\n        public void CacheableMethodPocoGetValuePassNullTimed()\n        {\n#if DEBUG\n            Assert.Ignore(\"Visual Studio slows down dynamic too much in debug mode\");\n#endif\n\n            var tValue = new OverloadingMethPoco();\n\n\n\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.InvokeMember, \"Func\", argCount:1);\n\n            Timer.Action1=(() => { var tOut = tCachedInvoke.Invoke(tValue, null); });\n            var tMethodInfo = tValue.GetType().GetMethod(\"Func\", new Type[] { typeof(object) });\n            Timer.Action2=(() =>\n            {\n                var tOut = tMethodInfo.Invoke(tValue, new object[] { null });\n            });\n                \n            var elapsed = Timer.Go();\n\n            Console.WriteLine(\"Impromptu: \" + elapsed.Item1);\n            Console.WriteLine(\"Refelection: \" + elapsed.Item2);\n            Console.WriteLine(\"Impromptu VS Reflection: {0}\", TimeIt.RelativeSpeed(elapsed));\n            Assert.Less(elapsed.Item1, elapsed.Item2);\n        }\n\n\n        [Test]\n        public void MethodPocoGetValuePassNullDoubleCallTimed()\n        {\n#if DEBUG\n            Assert.Ignore(\"Visual Studio slows down dynamic too much in debug mode\");\n#endif\n            var tValue = new OverloadingMethPoco();\n\n\n            Timer.Action1=(() => { \n                var tOut = Dynamic.InvokeMember(tValue, \"Func\", null); \n                var tOut2 = Dynamic.InvokeMember(tValue, \"Func\", 2); });\n\n            var tMethodInfo = tValue.GetType().GetMethod(\"Func\", new Type[] { typeof(object) });\n            var tMethodInfo2 = tValue.GetType().GetMethod(\"Func\", new Type[] { typeof(int) });\n            Timer.Action2=(() =>\n            {\n                var tOut = tMethodInfo.Invoke(tValue, new object[] { null });\n                var tOut2 = tMethodInfo2.Invoke(tValue, new object[] { 2 });\n            });\n\n            var elapsed = Timer.Go(3 * TimeIt.Million);\n\n            Console.WriteLine(\"Impromptu: \" + elapsed.Item1);\n            Console.WriteLine(\"Refelection: \" + elapsed.Item2);\n            Console.WriteLine(\"Impromptu VS Reflection: {0}\", TimeIt.RelativeSpeed(elapsed));\n            Assert.Less(elapsed.Item1, elapsed.Item2);\n        }\n\n        [Test]\n        public void CacheableMethodPocoGetValuePassNullDoubleCallTimed()\n        {\n            var tValue = new OverloadingMethPoco();\n\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.InvokeMember, \"Func\", 1);\n            Timer.Action1=(() =>\n            {\n                var tOut = tCachedInvoke.Invoke(tValue, null);\n                var tOut2 = tCachedInvoke.Invoke(tValue, 2);\n            });\n\n            var tMethodInfo = tValue.GetType().GetMethod(\"Func\", new Type[] { typeof(object) });\n            var tMethodInfo2 = tValue.GetType().GetMethod(\"Func\", new Type[] { typeof(int) });\n            Timer.Action2=(() =>\n            {\n                var tOut = tMethodInfo.Invoke(tValue, new object[] { null });\n                var tOut2 = tMethodInfo2.Invoke(tValue, new object[] { 2 });\n            });\n                   \n            var elapsed = Timer.Go();\n\n             Console.WriteLine(\"Impromptu: \" + elapsed.Item1);\n            Console.WriteLine(\"Refelection: \" + elapsed.Item2);\n            Console.WriteLine(\"Impromptu VS Reflection: {0}\", TimeIt.RelativeSpeed(elapsed));\n            Assert.Less(elapsed.Item1, elapsed.Item2);\n        }\n\n        [Test]\n        public void MethodPocoGetValue4argsTimed()\n        {\n\n#if DEBUG\n            Assert.Ignore(\"Visual Studio slows down dynamic too much in debug mode\");\n#endif\n            var tValue = \"test 123 45 string\";\n\n\n\n            Timer.Action1=(() => { var tOut = Dynamic.InvokeMember(tValue, \"IndexOf\", \"45\", 0, 14, StringComparison.InvariantCulture); });\n            var tMethodInfo = tValue.GetType().GetMethod(\"IndexOf\", new Type[] { typeof(string), typeof(int), typeof(int), typeof(StringComparison) });\n            Timer.Action2=(() =>\n                                        {\n                                            var tOut = tMethodInfo.Invoke(tValue, new object[] { \"45\", 0, 14, StringComparison.InvariantCulture });\n                                        });\n\n               var elapsed = Timer.Go();\n\n             Console.WriteLine(\"Impromptu: \" + elapsed.Item1);\n            Console.WriteLine(\"Refelection: \" + elapsed.Item2);\n            Console.WriteLine(\"Impromptu VS Reflection: {0}\", TimeIt.RelativeSpeed(elapsed));\n            Assert.Less(elapsed.Item1, elapsed.Item2);\n        }\n\n        [Test]\n        public void CacheableMethodPocoGetValue4argsTimed()\n        {\n\n\n            var tValue = \"test 123 45 string\";\n\n\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.InvokeMember, \"IndexOf\", 4);\n            Timer.Action1=(() =>\n                                       {\n                                           var tOut = tCachedInvoke.Invoke(tValue,\"45\", 0, 14, StringComparison.InvariantCulture);\n                                       });\n            var tMethodInfo = tValue.GetType().GetMethod(\"IndexOf\", new Type[] { typeof(string), typeof(int), typeof(int), typeof(StringComparison) });\n            Timer.Action2=(() =>\n            {\n                var tOut = tMethodInfo.Invoke(tValue, new object[] { \"45\", 0, 14, StringComparison.InvariantCulture });\n            });\n\n             var elapsed = Timer.Go();\n\n             Console.WriteLine(\"Impromptu: \" + elapsed.Item1);\n            Console.WriteLine(\"Refelection: \" + elapsed.Item2);\n            Console.WriteLine(\"Impromptu VS Reflection: {0}\", TimeIt.RelativeSpeed(elapsed));\n            Assert.Less(elapsed.Item1, elapsed.Item2);\n        }\n \n\n        [Test]\n        public void MethodPocoVoidTimed()\n        {\n\n#if DEBUG\n            Assert.Ignore(\"Visual Studio slows down dynamic too much in debug mode\");\n#endif\n            var tValue = new Dictionary<object,object>();\n\n\n\n            Timer.Action1=(() => Dynamic.InvokeMemberAction(tValue, \"Clear\"));\n            var tMethodInfo = tValue.GetType().GetMethod(\"Clear\", new Type[] { });\n            Timer.Action2=(() => tMethodInfo.Invoke(tValue, new object[] { }));\n\n             var elapsed = Timer.Go(5 * TimeIt.Million);\n\n             Console.WriteLine(\"Impromptu: \" + elapsed.Item1);\n            Console.WriteLine(\"Refelection: \" + elapsed.Item2);\n            Console.WriteLine(\"Impromptu VS Reflection: {0}\", TimeIt.RelativeSpeed(elapsed));\n            Assert.Less(elapsed.Item1, elapsed.Item2);\n        }\n\n        [Test]\n        public void CacheableMethodPocoVoidTimed()\n        {\n\n\n            var tValue = new Dictionary<object, object>();\n\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.InvokeMemberAction, \"Clear\");\n\n            Timer.Action1=(() => tCachedInvoke.Invoke(tValue));\n            var tMethodInfo = tValue.GetType().GetMethod(\"Clear\", new Type[] { });\n            Timer.Action2=(() => tMethodInfo.Invoke(tValue, new object[] { }));\n               \n            var elapsed = Timer.Go();\n                  \n            Console.WriteLine(\"Impromptu: \" + elapsed.Item1);\n            Console.WriteLine(\"Refelection: \" + elapsed.Item2);\n            Console.WriteLine(\"Impromptu VS Reflection: {0}\", TimeIt.RelativeSpeed(elapsed));\n            Assert.Less(elapsed.Item1, elapsed.Item2);\n        }\n\n    \n\n\n        [Test]\n        public void SetTimed()\n        {\n\n#if DEBUG\n            Assert.Ignore(\"Visual Studio slows down dynamic too much in debug mode\");\n#endif\n            \n            var tPoco1 = new PropPoco();\n            var tPoco2 = new PropPoco();\n            var tSetValue = \"1\";\n\n            Timer.Action1 = () => Dynamic.InvokeSet(tPoco1, \"Prop1\", tSetValue);\n            var tPropertyInfo = tPoco2.GetType().GetProperty(\"Prop1\");\n            Timer.Action2 = () => tPropertyInfo.SetValue(tPoco2, tSetValue, new object[] { });\n\n            var elapsed = Timer.Go(5* TimeIt.Million);\n\n            Console.WriteLine(\"Impromptu: \" + elapsed.Item1);\n            Console.WriteLine(\"Refelection: \" + elapsed.Item2);\n            Console.WriteLine(\"Impromptu VS Reflection: {0}\", TimeIt.RelativeSpeed(elapsed));\n            Assert.Less(elapsed.Item1, elapsed.Item2);\n        }\n\n        [Test]\n        public void CacheableSetTimed()\n        {\n\n            var tPoco1 = new PropPoco();\n            var tPoco2 = new PropPoco();\n\n            var tSetValue = \"1\";\n\n            var tCacheable = new CacheableInvocation(InvocationKind.Set, \"Prop1\");\n            Timer.Action1 = () => tCacheable.Invoke(tPoco1, tSetValue);\n\n            var tPropertyInfo = tPoco2.GetType().GetProperty(\"Prop1\");\n            Timer.Action2 = () => tPropertyInfo.SetValue(tPoco2, tSetValue, new object[] { });\n\n            var elapsed = Timer.Go();\n\n\n            Console.WriteLine(\"Impromptu: \" + elapsed.Item1);\n            Console.WriteLine(\"Refelection: \" + elapsed.Item2);\n            Console.WriteLine(\"Impromptu VS Reflection: {0}\", TimeIt.RelativeSpeed(elapsed));\n            Assert.Less(elapsed.Item1, elapsed.Item2);\n        }\n\n        [Test]\n        public void CacheableSetNullTimed()\n        {\n            var tPoco = new PropPoco();\n\n            String tSetValue = null;\n            var tCachedInvoke = new CacheableInvocation(InvocationKind.Set, \"Prop1\");\n            Timer.Action1 = (() => tCachedInvoke.Invoke(tPoco, tSetValue));\n            var tPropertyInfo = tPoco.GetType().GetProperty(\"Prop1\");\n            Timer.Action2 = (() => tPropertyInfo.SetValue(tPoco, tSetValue, new object[] { }));\n\n            var elapsed = Timer.Go();\n\n            Console.WriteLine(\"Impromptu: \" + elapsed.Item1);\n            Console.WriteLine(\"Refelection: \" + elapsed.Item2);\n            Console.WriteLine(\"Impromptu VS Reflection: {0}\", TimeIt.RelativeSpeed(elapsed));\n            Assert.Less(elapsed.Item1, elapsed.Item2);\n        }\n\n        [Test]\n        public void SetNullTimed()\n        {\n#if DEBUG\n            Assert.Ignore(\"Visual Studio slows down dynamic too much in debug mode\");\n#endif\n            var tPoco1 = new PropPoco();\n            var tPoco2 = new PropPoco();\n\n            String tSetValue = null;\n\n            Timer.Action1 = () => Dynamic.InvokeSet(tPoco1, \"Prop1\", tSetValue);\n            var tPropertyInfo = tPoco2.GetType().GetProperty(\"Prop1\");\n            Timer.Action2 = () => tPropertyInfo.SetValue(tPoco2, tSetValue, new object[] { });\n\n            var elapsed = Timer.Go(5 * TimeIt.Million);\n\n\n            Console.WriteLine(\"Impromptu: \" + elapsed.Item1);\n            Console.WriteLine(\"Refelection: \" + elapsed.Item2);\n            Console.WriteLine(\"Impromptu VS Reflection: {0}\", TimeIt.RelativeSpeed(elapsed));\n            Assert.Less(elapsed.Item1, elapsed.Item2);\n        }\n\n\n            [Test]\n        public void FastDynamicInvoke()\n        {\n            Func<int, bool> tFunc = it => it > 10;\n             Timer.Action1 =(() => tFunc.FastDynamicInvoke(5));\n\n              Timer.Action2 = (() => tFunc.DynamicInvoke(5));\n\n  \n            var elapsed = Timer.Go();\n\n            Console.WriteLine(\"Impromptu: \" + elapsed.Item1);\n            Console.WriteLine(\"Refelection: \" + elapsed.Item2);\n            Console.WriteLine(\"Impromptu VS Reflection: {0}\", TimeIt.RelativeSpeed(elapsed));\n            Assert.Less(elapsed.Item1, elapsed.Item2);\n        }\n\n        [Test]\n        public void FastDynamicInvokeAction()\n        {\n            Action<int> tFunc = it => it.ToString();\n              Timer.Action1 = (() => tFunc.FastDynamicInvoke(5));\n\n             Timer.Action2 = (() => tFunc.DynamicInvoke(5));\n            \n            var elapsed = Timer.Go();\n\n            Console.WriteLine(\"Impromptu: \" + elapsed.Item1);\n            Console.WriteLine(\"Refelection: \" + elapsed.Item2);\n            Console.WriteLine(\"Impromptu VS Reflection: {0}\", TimeIt.RelativeSpeed(elapsed));\n            Assert.Less(elapsed.Item1, elapsed.Item2);\n        }\n\n\n        [Test]\n        public void IsTupleTimed()\n        {\n\n            object tup = Tupler.Create(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20);\n\n            Timer.Action1 = () => Tupler.IsTuple(tup);\n\n            Timer.Action2 = () => FSharpType.IsTuple(tup.GetType());\n\n            var elapsed = Timer.Go();\n\n\n            Console.WriteLine(\"Impromptu: \" + elapsed.Item1);\n            Console.WriteLine(\"FSharp Refelection: \" + elapsed.Item2);\n            Console.WriteLine(\"Impromptu VS FSharp Reflection: {0}\", TimeIt.RelativeSpeed(elapsed));\n            Assert.Less(elapsed.Item1, elapsed.Item2);\n        }\n\n\n        [Test]\n        public void TupleIndexTimed()\n        {\n\n            object tup = Tupler.Create(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20);\n\n            Timer.Action1 = () => Tupler.Index(tup,14);\n\n            Timer.Action2 = () => FSharpValue.GetTupleField(tup,14);\n\n            var elapsed = Timer.Go(50000);\n\n\n            Console.WriteLine(\"Impromptu: \" + elapsed.Item1);\n            Console.WriteLine(\"FSharp Refelection: \" + elapsed.Item2);\n            Console.WriteLine(\"Impromptu VS FSharp Reflection: {0}\", TimeIt.RelativeSpeed(elapsed));\n            Assert.Less(elapsed.Item1, elapsed.Item2);\n        }\n      \n\n        [Test]\n        public void TupleToListTimed()\n        {\n\n            object tup = Tupler.Create(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20);\n\n            Timer.Action1 = () => Tupler.ToList(tup);\n        \n            Timer.Action2 = () => FSharpValue.GetTupleFields(tup).ToList();\n\n            var elapsed = Timer.Go(50000);\n\n\n            Console.WriteLine(\"Impromptu: \" + elapsed.Item1);\n            Console.WriteLine(\"FSharp Refelection: \" + elapsed.Item2);\n            Console.WriteLine(\"Impromptu VS FSharp Reflection: {0}\", TimeIt.RelativeSpeed(elapsed));\n            Assert.Less(elapsed.Item1, elapsed.Item2);\n        }\n\n        [Test]\n        public void ListToTupleTimed()\n        {\n            var list = new object[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20};\n\n            Timer.Action1 = () => Tupler.ToTuple(list);\n\n            Timer.Action2 = () =>\n                                {\n                                    var types = list.Select(it => it.GetType()).ToArray();\n                                    var tupType = FSharpType.MakeTupleType(types);\n                                    FSharpValue.MakeTuple(list, tupType);\n                                };\n\n            var elapsed = Timer.Go(50000);\n\n\n            Console.WriteLine(\"Impromptu: \" + elapsed.Item1);\n            Console.WriteLine(\"FSharp Refelection: \" + elapsed.Item2);\n            Console.WriteLine(\"Impromptu VS FSharp Reflection: {0}\", TimeIt.RelativeSpeed(elapsed));\n            Assert.Less(elapsed.Item1, elapsed.Item2);\n\n        }\n    }\n}\n"
  },
  {
    "path": "Tests/Tests.csproj",
    "content": "﻿<Project Sdk=\"Microsoft.NET.Sdk\">\n  <PropertyGroup>\n    <TargetFrameworks>net8.0;net48</TargetFrameworks>\n\t  <IsPackable>false</IsPackable>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <PackageReference Include=\"ImpromptuInterface\" Version=\"8.0.*\" />\n    <PackageReference Include=\"Microsoft.CSharp\" Version=\"4.*\" />\n    <PackageReference Include=\"NUnit\" Version=\"3.13.3\" />\n    <PackageReference Include=\"FSharp.Core\" Version=\"4.7.2\" />\n    <PackageReference Include=\"Moq\" Version=\"4.20.69\" />\n    <PackageReference Include=\"NUnit.Console\" Version=\"3.16.3\" />\n    <PackageReference Include=\"IronPython\" Version=\"2.7.12\" />\n    <PackageReference Include=\"System.Drawing.Common\" Version=\"8.0.11\"/>\n\n  </ItemGroup>\n\n \n  <ItemGroup>\n    <PackageReference Include=\"NUnit3TestAdapter\" Version=\"4.5.0\" />\n    <PackageReference Include=\"Microsoft.NET.Test.Sdk\" Version=\"17.7.2\" />\n  </ItemGroup>\n\n  <ItemGroup>\n    <ProjectReference Include=\"..\\Dynamitey\\Dynamitey.csproj\" />\n    <ProjectReference Include=\"..\\SupportLibrary\\SupportLibrary.csproj\" />\n  </ItemGroup>\n</Project>\n"
  },
  {
    "path": "Tests/TimeIt.cs",
    "content": "﻿using System;\nusing System.Diagnostics;\nusing NUnit.Framework;\n\nnamespace Dynamitey.Tests\n{\n    public class TimeIt\n    {\n        public const int Million = 1000000;\n\n        private Stopwatch _watch1;\n        private Stopwatch _watch2;\n        private Stopwatch _watch3;\n        private bool _skipInitializationCosts;\n        public TimeIt(bool skipInitializationCosts = false)\n        {\n            _watch1 = new Stopwatch();\n            _watch2 = new Stopwatch();\n            _watch3 = new Stopwatch();\n            _skipInitializationCosts = skipInitializationCosts;\n        }\n        public Tuple<TimeSpan, TimeSpan, TimeSpan> GoThree(int iteration = Million, bool useThree = true)\n        {\n            if (_skipInitializationCosts)\n            {\n                iteration++;\n            }\n\n            for (int i = 0; i < iteration; i++)\n            {\n                _watch1.Start();\n                Action1();\n                _watch1.Stop();\n                _watch2.Start();\n                Action2();\n                _watch2.Stop();\n                if (useThree)\n                {\n                    _watch3.Start();\n                    Action3();\n                    _watch3.Stop();\n                }\n\n                if (i == 0 && _skipInitializationCosts)\n                {\n                    _watch1.Reset();\n                    _watch2.Reset();\n                    _watch3.Reset();\n                }\n            }\n\n            return Tuple.Create(_watch1.Elapsed, _watch2.Elapsed, _watch3.Elapsed);\n\n        }\n        public Tuple<TimeSpan, TimeSpan> Go(int iteration = Million)\n        {\n            var goThree = GoThree(iteration, false);\n            return Tuple.Create(goThree.Item1, goThree.Item2);\n        }\n\n        public Action Action1 { get; set; }\n        public Action Action2 { get; set; }\n        public Action Action3 { get; set; }\n\n        public static string RelativeSpeed(Tuple<TimeSpan, TimeSpan> elapsed)\n        {\n            if (\n                (elapsed.Item2 > elapsed.Item1 &&\n                 (double)elapsed.Item2.Ticks / elapsed.Item1.Ticks < 1.4)\n                ||\n                (elapsed.Item1 > elapsed.Item2 &&\n                 (double)elapsed.Item1.Ticks / elapsed.Item2.Ticks < 1.4)\n                )\n            {\n                Assert.Ignore(\"Equivalent\");\n            }\n\n\n            if (elapsed.Item2 > elapsed.Item1)\n                return String.Format(\" {0:0.0} x faster\", (double)elapsed.Item2.Ticks / elapsed.Item1.Ticks);\n            if (elapsed.Item1 > elapsed.Item2)\n                return String.Format(\" {0:0.0} x slower\", (double)elapsed.Item1.Ticks / elapsed.Item2.Ticks);\n            return String.Format(\"Equivalent\");\n        }\n    }\n}"
  },
  {
    "path": "Tests/TuplerTest.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Dynamitey;\nusing NUnit.Framework;\n\nnamespace Dynamitey.Tests\n{\n    [TestFixture]\n    public class TuplerTest\n    {\n\n        [Test]\n        public void DynamicCreateTypedTuple()\n        {\n            object tup = Tupler.Create(1, \"2\", \"3\", 4);\n\n            var tup2 = Tuple.Create(1, \"2\", \"3\", 4);\n\n            Assert.That(tup, Is.TypeOf(tup2.GetType()));\n\n            Assert.That(tup, Is.EqualTo(tup2));\n        }\n\n        [Test]\n        public void DynamicCreateTypedTuple8()\n        {\n            object tup = Tupler.Create(1, \"2\", \"3\", 4,\n                    5, 6, 7, \"8\");\n\n            var tup2 = Tuple.Create(1, \"2\", \"3\", 4, 5, 6, 7, \"8\");\n\n            Assert.That(tup,Is.TypeOf(tup2.GetType()));\n\n            Assert.That(tup, Is.EqualTo(tup2));\n        }\n\n        [Test]\n        public void DynamicCreateLongTypedTuple()\n        {\n            object tup = Tupler.Create(1, \"2\", \"3\", 4,\n                    5, 6, 7, \"8\", \"9\", 10, \"11\", 12);\n\n            var tup2 = new Tuple<int, string, string, int, int, int, int, Tuple<string, string, int, string, int>>(\n                1, \"2\", \"3\", 4,\n                5, 6, 7, Tuple.Create(\"8\", \"9\", 10, \"11\", 12)\n                );\n\n            Assert.That(tup, Is.TypeOf(tup2.GetType()));\n\n            Assert.That(tup, Is.EqualTo(tup2));\n        }\n\n        [Test]\n        public void DynamicTupleSize()\n        {\n            var tup = Tuple.Create(1, 2, 3, 4, 5);\n\n            Assert.That((object)Tupler.Size(tup),Is.EqualTo(5));\n        }\n        [Test]\n        public void DynamicTupleSize8()\n        {\n            var tup = Tuple.Create(1, 2, 3, 4, 5,6,7,8);\n\n            Assert.That((object)Tupler.Size(tup), Is.EqualTo(8));\n        }\n        [Test]\n        public void DynamicTupleSize20()\n        {\n            var tup = Tupler.Create(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);\n\n            Assert.That((object)Tupler.Size(tup), Is.EqualTo(20));\n        }\n\n        [Test]\n        public void DynamicTupleToList()\n        {\n            var tup =Tuple.Create(1, 2, 3, 4, 5);\n            var exp=Enumerable.Range(1,5).ToList();\n            Assert.That((object)Tupler.ToList(tup),Is.EqualTo(exp));\n\n        }\n\n        [Test]\n        public void DynamicTupleToList8()\n        {\n            var tup = Tuple.Create(1, 2, 3, 4, 5, 6, 7, 8);\n            var exp = Enumerable.Range(1, 8).ToList();\n            Assert.That((object)Tupler.ToList(tup), Is.EqualTo(exp));\n        }\n\n        [Test]\n        public void DynamicTupleToList20()\n        {\n            var tup = Tupler.Create(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20);\n            var exp = Enumerable.Range(1, 20).ToList();\n            Assert.That((object)Tupler.ToList(tup), Is.EqualTo(exp));\n        }\n\n\n\n        [Test]\n        public void DynamicListToTuple()\n        {\n            var exp = Enumerable.Range(1, 5).ToList();\n            var tup = exp.ToTuple();\n            Assert.That((object)Tupler.IsTuple(tup), Is.True);\n            Assert.That((object)Tupler.ToList(tup), Is.EqualTo(exp));\n\n        }\n\n        [Test]\n        public void DynamicListToTuplet8()\n        {\n            var exp = Enumerable.Range(1, 8).ToList();\n            var tup = exp.ToTuple();\n            Assert.That((object)Tupler.IsTuple(tup), Is.True);\n            Assert.That((object)Tupler.ToList(tup), Is.EqualTo(exp));\n        }\n\n        [Test]\n        public void DynamicListToTuple20()\n        {\n    \n            var exp = Enumerable.Range(1, 20).ToList();\n            var tup = exp.ToTuple();\n            Assert.That((object)Tupler.IsTuple(tup), Is.True);\n            Assert.That((object)Tupler.ToList(tup), Is.EqualTo(exp));\n        }\n\n\n\n        [Test]\n        public void DynamicTupleIndex()\n        {\n            var tup = Tupler.Create(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20);\n            Assert.That((object)Tupler.Index(tup,5), Is.EqualTo(6));\n        }\n\n        [Test]\n        public void DynamicTupleIndex7()\n        {\n            var tup = Tupler.Create(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20);\n            Assert.That((object)Tupler.Index(tup, 7), Is.EqualTo(8));\n        }\n\n        [Test]\n        public void DynamicTupleIndex19()\n        {\n            var tup = Tupler.Create(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20);\n            Assert.That((object)Tupler.Index(tup, 19), Is.EqualTo(20));\n        }\n    }\n}\n"
  },
  {
    "path": "Version.props",
    "content": "<Project>\n    <PropertyGroup>\n        <VersionPrefix>3.0.4</VersionPrefix>\n        <VersionSuffix Condition=\" '$(GITHUB_RUN_NUMBER)' != '' \">preview$(GITHUB_RUN_NUMBER)</VersionSuffix>\n    </PropertyGroup>\n</Project>"
  },
  {
    "path": "build.fsx",
    "content": "#!/bin/sh\n#if bin_sh\n  # Doing this because arguments can't be used with /usr/bin/env on linux, just mac\n  exec fsharpi --define:mono_posix --exec $0 $*\n#endif\n#if FSharp_MakeFile\n\n(*\n * Single File Crossplatform FSharp Makefile Bootstrapper\n * Apache licensed - Copyright 2014 Jay Tuley <jay+code@tuley.name>\n * v 2.0 https://gist.github.com/jbtule/11181987\n *\n * How to use:\n *  On Windows `fsi --exec build.fsx <buildtarget>\n *    *Note:* if you have trouble first run \"%vs120comntools%\\vsvars32.bat\" or use the \"Developer Command Prompt for VS201X\"\n *                                                           or install https://github.com/Iristyle/Posh-VsVars#posh-vsvars\n *\n *  On Mac Or Linux `./build.fsx <buildtarget>`\n *    *Note:* But if you have trouble then use `sh build.fsx <buildtarget>`\n *\n *)\n\n#I \"packages/FAKE/tools\"\n#r \"FakeLib.dll\"\n#r \"System.Xml.Linq.dll\"\n\nopen Fake\nopen System.Xml.Linq\nopen System.Xml.XPath\n\nlet sln = \"./Dynamitey.sln\"\n\nlet commonBuild target =\n    let buildMode = getBuildParamOrDefault \"configuration\" \"Release\"\n    let vsuffix = getBuildParamOrDefault \"vsuffix\" \"\"\n\n    let versionPrefix = \"Version.props\" \n                        |> System.IO.File.ReadAllText \n                        |> XDocument.Parse\n                        |> (fun x -> x.XPathEvaluate(\"//VersionPrefix/text()\"))\n                        |> (fun x-> x :?> seq<obj>)\n                        |> Seq.exactlyOne\n                        |> sprintf \"%A\"\n\n    let vProp =\n        if System.Text.RegularExpressions.Regex.IsMatch(vsuffix, \"^\\d+$\") then \n            \"Version\", versionPrefix + \".\" + vsuffix\n        else\n            \"VersionSuffix\", vsuffix\n\n    let setParams defaults =\n            { defaults with\n                Verbosity = Some(Quiet)\n                Targets = [target]\n                Properties =\n                    [\n                        \"Configuration\", buildMode\n                        vProp\n                    ]\n            }\n    build setParams sln\n          |> DoNothing\n\nTarget \"Restore\" (fun () ->\n    trace \" --- Restore Packages --- \"\n\n    //because nuget doesn't know how to find msbuild15 on linux \n    let restoreProj = fun args ->\n                   directExec (fun info ->\n                       info.FileName <- \"msbuild\"\n                       info.Arguments <- \"/t:restore \" + args) |> ignore\n\n    sln |> restoreProj\n \n)\n\nTarget \"Clean\" (fun () ->\n    trace \" --- Cleaning stuff --- \"\n    commonBuild \"Clean\"\n)\n\nTarget \"Build\" (fun () ->\n    trace \" --- Building the libs --- \"\n    commonBuild \"Build\"\n)\n\nTarget \"Test\" (fun () ->\n    trace \" --- Test the libs --- \"\n    \n    let nunit3exe = \"./packages/nunit.consolerunner/3.7.0/tools/nunit3-console.exe\"\n\n    let buildMode = getBuildParamOrDefault \"configuration\" \"Release\"\n\n    let testDir = sprintf \"./Tests/bin/%s/net462/\" buildMode\n\n    let netExe, netAppVeyor,coreAppVeyor =\n        if buildServer = AppVeyor then\n            \"nunit3-console\",\"--result=myresults.xml;format=AppVeyor\", \"--logger=trx;LogFileName=testresults.trx\"\n        else\n            nunit3exe,\"--noresult\",\"\"\n\n\n    let s1 = \n        directExec (fun info ->  \n          info.FileName <- netExe\n          info.Arguments <- sprintf \"--labels=All %s --where=\\\"cat != Performance\\\" %s\"     netAppVeyor (testDir + \"Tests.exe\"))\n       \n    \n    let s2 =\n        directExec (fun info ->  \n          info.FileName <- \"dotnet\" \n          info.Arguments <- sprintf \"test Tests/Tests.csproj -f netcoreapp2.0 --no-build --no-restore --filter=TestCategory!=Performance %s --configuration=%s\" coreAppVeyor buildMode)\n\n    let appveyor = environVarOrNone \"APPVEYOR_JOB_ID\"\n    match appveyor with\n        | Some(jobid) -> \n             use webClient = new System.Net.WebClient()\n             webClient.UploadFile(sprintf \"https://ci.appveyor.com/api/testresults/mstest/%s\" jobid,\"./Tests/TestResults/testresults.trx\") |> ignore\n        | None -> ()\n\n    if(not s1 || not s2) then\n        failwith \"Tests failed\"\n\n)    \n\n\"Restore\"\n  ==> \"Build\"\n  ==> \"Test\"\n\nRunTargetOrDefault \"Test\"\n\n\n#else\n\nopen System\nopen System.IO\nopen System.Diagnostics\n\n(* helper functions *)\n#if mono_posix\n#r \"Mono.Posix.dll\"\nopen Mono.Unix.Native\nlet applyExecutionPermissionUnix path =\n    let _,stat = Syscall.lstat(path)\n    Syscall.chmod(path, FilePermissions.S_IXUSR ||| stat.st_mode) |> ignore\n#else\nlet applyExecutionPermissionUnix path = ()\n#endif\n\nlet doesNotExist path =\n    path |> Path.GetFullPath |> File.Exists |> not\n\nlet execAt (workingDir:string) (exePath:string) (args:string seq) =\n    let processStart (psi:ProcessStartInfo) =\n        let ps = Process.Start(psi)\n        ps.WaitForExit ()\n        ps.ExitCode\n    let fullExePath = exePath |> Path.GetFullPath\n    applyExecutionPermissionUnix fullExePath\n    let exitCode = ProcessStartInfo(\n                        fullExePath,\n                        args |> String.concat \" \",\n                        WorkingDirectory = (workingDir |> Path.GetFullPath),\n                        UseShellExecute = false)\n                   |> processStart\n    if exitCode <> 0 then\n        exit exitCode\n    ()\n\nlet exec = execAt Environment.CurrentDirectory\n\nlet downloadNugetTo path =\n    let fullPath = path |> Path.GetFullPath;\n    if doesNotExist fullPath then\n        printf \"Downloading NuGet...\"\n        use webClient = new System.Net.WebClient()\n        fullPath |> Path.GetDirectoryName |> Directory.CreateDirectory |> ignore\n        webClient.DownloadFile(\"https://dist.nuget.org/win-x86-commandline/latest/nuget.exe\", path |> Path.GetFullPath)\n        printfn \"Done.\"\n\nlet passedArgs = fsi.CommandLineArgs.[1..] |> Array.toList\n\n(* execution script customize below *)\n\nlet makeFsx = fsi.CommandLineArgs.[0]\n\nlet nugetExe = \".nuget/NuGet.exe\"\nlet fakeExe = \"packages/FAKE/tools/FAKE.exe\"\n\ndownloadNugetTo nugetExe\n\nif doesNotExist fakeExe then\n    exec nugetExe [\"install\"; \"fake\"; \"-OutputDirectory packages\"; \"-ExcludeVersion\"]\n\nexec fakeExe ([makeFsx; \"-d:FSharp_MakeFile\"] @ passedArgs)\n\n#endif"
  }
]