{"id":20153672,"url":"https://github.com/anupsarkar-dev/csharprecordtoclass","last_synced_at":"2025-09-14T06:39:16.828Z","repository":{"id":189449684,"uuid":"678747350","full_name":"anupsarkar-dev/CsharpRecordToClass","owner":"anupsarkar-dev","description":"Convert your C# record type to class type","archived":false,"fork":false,"pushed_at":"2023-11-16T06:21:59.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-03T01:28:04.819Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/anupsarkar-dev.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":"2023-08-15T09:25:09.000Z","updated_at":"2023-08-15T09:25:17.000Z","dependencies_parsed_at":"2024-11-13T23:31:06.628Z","dependency_job_id":null,"html_url":"https://github.com/anupsarkar-dev/CsharpRecordToClass","commit_stats":null,"previous_names":["anupsarkar-dev/csharprecordtoclass"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/anupsarkar-dev/CsharpRecordToClass","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anupsarkar-dev%2FCsharpRecordToClass","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anupsarkar-dev%2FCsharpRecordToClass/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anupsarkar-dev%2FCsharpRecordToClass/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anupsarkar-dev%2FCsharpRecordToClass/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anupsarkar-dev","download_url":"https://codeload.github.com/anupsarkar-dev/CsharpRecordToClass/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anupsarkar-dev%2FCsharpRecordToClass/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275071546,"owners_count":25400398,"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-09-14T02:00:10.474Z","response_time":75,"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-11-13T23:20:29.533Z","updated_at":"2025-09-14T06:39:16.800Z","avatar_url":"https://github.com/anupsarkar-dev.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CsharpRecordToClass\nConvert your C# record type to class type\n\n\nOften while creating POCO or DTO type , we use C# record or class type.\nMany times we have to manually convert C# class to record type or vice versa which is time consuming.\n\nLets automate this:\n\nfor example we have a record type:\nNow we want to convert it to a class or vice versa\n\nHere is the simple C# program to do it:\n\n```\nstring RecortToClass(string input) {\n  string recordNamePattern = @ \"\\s+record\\s+(\\w+)\";\n  string propertyPattern = @ \"\\s+(\\w+\\??)\\s+(\\w+)\\s*[,]?\\s*$\";\n  var result = new StringBuilder();\n  Match recordNameMatch = Regex.Match(input, recordNamePattern);\n  if (recordNameMatch.Success \u0026\u0026 recordNameMatch.Groups.Count == 2) {\n    string recordName = recordNameMatch.Groups[1].Value;\n    result.Append($\"public class {recordName}\");\n  }\n  // Extract properties\n  MatchCollection matches = Regex.Matches(input, propertyPattern, RegexOptions.Multiline);\n  result.Append($\"\\n {{\");\n  foreach(Match match in matches) {\n    string type = match.Groups[1].Value; // property type\n    string name = match.Groups[2].Value; // property name\n    if (type.ToLower() != \"record\")\n      result.Append($\"\\n \\t public {type} {name} {{ get; set; }}\");\n  }\n  result.Append($\"\\n}}\");\n  return result.ToString();\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanupsarkar-dev%2Fcsharprecordtoclass","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanupsarkar-dev%2Fcsharprecordtoclass","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanupsarkar-dev%2Fcsharprecordtoclass/lists"}