{"id":25097030,"url":"https://github.com/micheledicosmo/staticvisitor","last_synced_at":"2026-05-08T10:36:07.792Z","repository":{"id":143547397,"uuid":"216787536","full_name":"micheledicosmo/StaticVisitor","owner":"micheledicosmo","description":"A customizable data structure static visitor for C#","archived":false,"fork":false,"pushed_at":"2021-03-03T18:59:16.000Z","size":66,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T02:22:12.773Z","etag":null,"topics":["data-structures-algorithms","dotnet","dotnet-library","dotnet-standard","dotnet-standard2","nuget-package"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/micheledicosmo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-22T10:33:57.000Z","updated_at":"2021-03-03T18:59:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"8fb22e4c-1a42-4239-a842-dcf41f52a9c2","html_url":"https://github.com/micheledicosmo/StaticVisitor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/micheledicosmo/StaticVisitor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micheledicosmo%2FStaticVisitor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micheledicosmo%2FStaticVisitor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micheledicosmo%2FStaticVisitor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micheledicosmo%2FStaticVisitor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/micheledicosmo","download_url":"https://codeload.github.com/micheledicosmo/StaticVisitor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micheledicosmo%2FStaticVisitor/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260308107,"owners_count":22989804,"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","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":["data-structures-algorithms","dotnet","dotnet-library","dotnet-standard","dotnet-standard2","nuget-package"],"created_at":"2025-02-07T17:19:46.978Z","updated_at":"2026-05-08T10:36:07.758Z","avatar_url":"https://github.com/micheledicosmo.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# StaticVisitor (namespace: Sid.Tools.StaticVisitor)\nA customizable data structure static visitor for C#.\n\nThis package, released under MIT license, allows to statically visit data structures easily in C#. Static visit means that it's the types (classes) of the data structure that get visited, not the instances.\n\n## Usages\nThe basic usage is to create an instance of `Sid.Tools.StaticVisitor.StaticVisitor` and pass an `IList\u003cStack\u003cTypeVisit\u003e\u003e` that will collect the results of the visit, then invoke the `Visit` method.\n\nOverloads for more advanced behaviour also exist, where you specify a custom `Action\u003cStack\u003cTypeVisit\u003e\u003e` which defines what custom action to execute upon visit.\n\nThe easiest way to access the visited type in the returned list or upon invocation of the above Action, is via the `[Stack\u003cTypeVisit\u003e].CurrentType()` or `[Stack\u003cTypeVisit\u003e].CurrentVisit()` extension methods, but it is possible to observe the entire stack as well, allowing to understand why a type was visited, and how it was reached.\n\nNote that not all types are visited by default: by default [primitive types](https://docs.microsoft.com/en-us/dotnet/api/system.type.isprimitive) and `object` are not visited; this behaviour can be customized (see below).\n\nVisit behaviour can be customized by passing a custom `StaticVisitorConfiguration` instance.\n\n### Basic example\nThe method `DoSomething`\n```\npublic class DataStructure {\n   public Property SomeProperty { get; }\n}\n\npublic class Property {}\n\npublic void DoSomething() {\n   var visitor = new StaticVisitor(out var list);\n   visitor.Visit(typeof(DataStructure));\n   foreach(var stack in list)\n     Console.WriteLine(stack.CurrentType())\n}\n```\nwill write the following types to the console:\n- `DataStructure`\n- `Property`\n\n### Custom type filtering example\nThe following code\n```\nvar visitor = new Sid.Tools.StaticVisitor.StaticVisitor(out var list, new Tools.DataStructure.StaticVisitorConfiguration()\n   {\n      TypeCanBeVisited = x =\u003e\n         Sid.Tools.StaticVisitor.StaticVisitorConfiguration.DefaultTypeCanBeVisited(x)\n         \u0026\u0026 !x.IsValueType\n   });\n```\nwill specify which types should be visited and which shouldn't.\nSpecifically it will preserve the default behaviour, but also exclude types that are value types.\n\n### Advanced configuration\nPlease refer to the docstring documentation in https://github.com/micheledicosmo/StaticVisitor/blob/master/StaticVisitor/StaticVisitor.cs in the object `StaticVisitorConfiguration`.\n\n## Order of visit\nThe types get visited following this order:\n- The type itself\n- Inherited types\n- Encompassing types\n- Assignable types (disabled by default)\n- Properties\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicheledicosmo%2Fstaticvisitor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicheledicosmo%2Fstaticvisitor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicheledicosmo%2Fstaticvisitor/lists"}