{"id":15035595,"url":"https://github.com/castilhera/csharp-code-snippets","last_synced_at":"2026-03-16T21:36:51.640Z","repository":{"id":252176049,"uuid":"835475317","full_name":"castilhera/csharp-code-snippets","owner":"castilhera","description":"C# Code Snippets","archived":false,"fork":false,"pushed_at":"2024-09-03T12:25:55.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-20T08:11:30.289Z","etag":null,"topics":["code-snippets","code-snippets-csharp","csharp","csharp-code"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/castilhera.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-07-29T23:20:46.000Z","updated_at":"2024-09-03T12:25:58.000Z","dependencies_parsed_at":"2024-11-19T06:46:12.321Z","dependency_job_id":null,"html_url":"https://github.com/castilhera/csharp-code-snippets","commit_stats":null,"previous_names":["castilhera/csharp-code-snippets"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/castilhera%2Fcsharp-code-snippets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/castilhera%2Fcsharp-code-snippets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/castilhera%2Fcsharp-code-snippets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/castilhera%2Fcsharp-code-snippets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/castilhera","download_url":"https://codeload.github.com/castilhera/csharp-code-snippets/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243401511,"owners_count":20285058,"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":["code-snippets","code-snippets-csharp","csharp","csharp-code"],"created_at":"2024-09-24T20:29:00.391Z","updated_at":"2025-12-28T21:58:40.037Z","avatar_url":"https://github.com/castilhera.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# C# Code Snippets\n\nA bunch of random C# code snippets that might help.\n\n## Extensions\n\n### Date Extensions\n\n\u003cdl\u003e\n  \u003cdt\u003eIsWeekend\u003c/dt\u003e\n  \u003cdd\u003eCheck if DayOfWeek is Saturday or Sunday. (Note: This does not apply to all countries and cultures. I found it useful for Brazil.)\u003c/dd\u003e\n  \u003cdt\u003eToFirstDayOfMonth\u003c/dt\u003e\n  \u003cdd\u003eReturns the first day of the month for the specified DateOnly/DateTime/DateTimeOffset.\u003c/dd\u003e\n  \u003cdt\u003eToLastDayOfMonth\u003c/dt\u003e\n  \u003cdd\u003eReturns the last day of the month for the specified DateOnly/DateTime/DateTimeOffset.\u003c/dd\u003e\n  \u003cdt\u003eGetIso8601WeekNumber\u003c/dt\u003e\n  \u003cdd\u003eReturns the week of the year, according to ISO-8601, for the specified DateTime.\u003c/dd\u003e\n\u003c/dl\u003e\n\n### Stream Extensions\n\n\u003cdl\u003e\n  \u003cdt\u003eReadLinesAsync\u003c/dt\u003e\n  \u003cdd\u003eReturns an iterator to read a stream line by line\u003c/dd\u003e\n\u003c/dl\u003e\n\n### String Extensions\n\n\u003cdl\u003e\n  \u003cdt\u003eReverse\u003c/dt\u003e\n  \u003cdd\u003eReverses a given string. e.g. ABCD =\u003e DCBA\u003c/dd\u003e\n  \u003cdt\u003eToSnakeCase\u003c/dt\u003e\n  \u003cdd\u003eConvert string to snake_case format. e.g. CodeSnippets =\u003e code_snippets\u003c/dd\u003e\n\u003c/dl\u003e\n\n## Helpers\n\n### Validation Helpers\n\n\u003cdl\u003e\n  \u003cdt\u003eIsValidCnpj\u003c/dt\u003e\n  \u003cdd\u003eCheck if the given string is a valid CNPJ.\u003c/dd\u003e\n\n  \u003cdt\u003eIsValidCpf\u003c/dt\u003e\n  \u003cdd\u003eCheck if the given string is a valid CPF.\u003c/dd\u003e\n\u003c/dl\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcastilhera%2Fcsharp-code-snippets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcastilhera%2Fcsharp-code-snippets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcastilhera%2Fcsharp-code-snippets/lists"}