{"id":16210458,"url":"https://github.com/rickyah/dynobind","last_synced_at":"2025-07-30T16:37:22.878Z","repository":{"id":28733253,"uuid":"32254544","full_name":"rickyah/DynoBind","owner":"rickyah","description":"Simplify late binding calls with C#","archived":false,"fork":false,"pushed_at":"2015-03-15T12:13:59.000Z","size":5296,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-15T11:24:37.820Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rickyah.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-15T10:23:49.000Z","updated_at":"2019-01-23T08:00:44.000Z","dependencies_parsed_at":"2022-09-05T00:11:24.585Z","dependency_job_id":null,"html_url":"https://github.com/rickyah/DynoBind","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/rickyah/DynoBind","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickyah%2FDynoBind","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickyah%2FDynoBind/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickyah%2FDynoBind/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickyah%2FDynoBind/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rickyah","download_url":"https://codeload.github.com/rickyah/DynoBind/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickyah%2FDynoBind/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267900023,"owners_count":24163001,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T10:38:57.965Z","updated_at":"2025-07-30T16:37:22.852Z","avatar_url":"https://github.com/rickyah.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"DynoBind aims to simplify late binding calls with C# in .NET versions that does not support the [dynamic type system](https://msdn.microsoft.com/en-us/library/dd264736.aspx)\n\n# Introduction\nUsing DynoBind you can make late binding calls in a simpler way using a [fluent interface](http://www.martinfowler.com/bliki/FluentInterface.html) instead of diving into .NET powerfull but complex Reflection system.\n\n\n# Usage example\nLet's try with an example. Suppose we have a `CExecutionManager` class whichexposes a property named `CommandExecuter` returning an object of type `CExecuter` that exposes a method  with the signagure `object Execute(string command)` which is the one we want to call. \n\nLet's see how to do this with .NET's reflection. Of course we are not dealing with error checks to keep the amount of code under control:\n\n```\n// Load the assembly and get the type you want to instantiate\nType CExecutionManagerType = Assembly.Load(\"CoreAssembly\")\n                .GetType(\"CExecutionManager\", false);\n\n// Create an instance of the type CExecutionManager\nobject executionMngInstance = new Invoker(Activator.CreateInstance(CExecutionManagerType));\n\n// Call the method/property and get \nobject cExecuterInstance = CExecutionManagerType\n            .InvokeMember(\"CommandExecuter\",\n                   BindingFlags.GetProperty,\n                   null,\n                   executionMngInstance,\n                   null);\n\n\n// Arguments to pass to the Execute method call\nobject[] args = new object[] { \"GET SIZE\" };\n \nobject result = cExecuterInstance.GetType()\n    .InvokeMember(\"Execute\",\n            BindingFlags.InvokeMethod,\n            null,\n            cExecuterInstance,\n            args);\n            \n// The Execute method can return multiple types so it need to return an object.\n// We can now cast the result to the type you are actually expecting, \n// as a user of the library you know that the \"GET SIZE\" command should \n// return an integer:\nint actualResult = (int)result;\n```\n\n\nNow let's compare how to do it with DynoBind\n\n```\n// Create the instance of CExecutionManager\nIDynamic executionMngInstance = BindingFactory.CreateObjectBinding(\"CoreAssembly\", \"CExecutionManager\");\n\ntry\n{\n    int size = executionMngInstance\n            // For the property \"CommandExecuter\"...\n            .Property(\"CommandExecuter\")\n            // get its value.\n            .Get\u003cIDynamic\u003e()\n            // Then, in the object the property returned we want to call the method...\n            .Method(\"Execute\")\n            // with this parameter...\n            .AddParameter(\"GET SIZE\")\n            // Here the method is invoked and we expect it to return an integer\n            .Invoke\u003cint\u003e();\n} catch (Exception ex)\n{\n    //something went wrong!\n}\n```\nWe even added error checks just because it is so easy! ;)\n\n# Documentation\n\nFor more help on using this library please check the [[Usage and examples|Usage and examples]] on the wiki","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frickyah%2Fdynobind","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frickyah%2Fdynobind","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frickyah%2Fdynobind/lists"}