{"id":17001986,"url":"https://github.com/rusith/urd","last_synced_at":"2025-04-12T06:21:31.851Z","repository":{"id":41215525,"uuid":"48853543","full_name":"rusith/URD","owner":"rusith","description":"undo redo pattern for .NET","archived":false,"fork":false,"pushed_at":"2017-03-12T11:46:29.000Z","size":233,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T01:41:31.543Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rusith.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}},"created_at":"2015-12-31T15:23:02.000Z","updated_at":"2022-02-10T10:29:24.000Z","dependencies_parsed_at":"2022-09-13T09:50:18.395Z","dependency_job_id":null,"html_url":"https://github.com/rusith/URD","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusith%2FURD","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusith%2FURD/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusith%2FURD/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rusith%2FURD/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rusith","download_url":"https://codeload.github.com/rusith/URD/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248525773,"owners_count":21118750,"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":[],"created_at":"2024-10-14T04:26:45.639Z","updated_at":"2025-04-12T06:21:31.814Z","avatar_url":"https://github.com/rusith.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# URD\n#undo redo pattern for .Net applications\n\n\nthis is a basic undo and redo pattern for .NET applications.\nin this pattern when you need an undo / redo able action you will need to warp that action in a using block.\nas an example if you going to change a property \n\n```C#\nusing (new PropertyChange(Object, \"Property\", \"Property changed \"))\n{\n  Object.Property=\"new value\";\n}\n```\nnow the change you made to the \"Property\" property of the \"Object\" object is added to a drop out stack and the action can undo and redo any time .\n\nif you want an undoAble list change you can do it using same syntax\n\n```C#\nprivate void AddNewItem(\u003cstring\u003eList list,string item,bool undoAble)\n{\n\tusing (undoAble?new ListChangeAddElement(list,item,\"add new string to the string list\"):null) //you can use a condition then you can minimize code\n\t{\n\t\tlist.Add(item);\n\t}\n}\n```\n\nRemoving an Item \n\n```C#\nprivate void RemoveItem(list,item,bool undoAble)\n{\n\tusing(undoAble?new ListChangeRemoveElement(list,item,list.IndexOf(item),\" remove \"+item+\" from the string list\"))\n\t{\n\t\tlist.Remove(item);\n\t}\n}\n```\nso on.. (check the code)\n\nbenefits of this pattern \n\n* No need to change existing objects\n* Low Memory usage\n\n\u003cb\u003eif you wish to implement your own operation . only thing you need to do is create a class--\u003e extend Change class and implement IUndoAble interface.\u003c/b\u003e \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frusith%2Furd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frusith%2Furd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frusith%2Furd/lists"}