Skip to main content

Timeline for Static typed Ids (integers) in C#

Current License: CC BY-SA 3.0

4 events
when toggle format what by license comment
Jan 23, 2016 at 16:36 comment added Dirk Boer Thanks svick. I might see if it's possible to autogenerate these in the T4 template files within Entity Framework.
Jan 23, 2016 at 16:04 comment added svick @DirkBoer Not really in plain C#. You probably could use something like PostSharp to add that code after normal compilation. Or use ReSharper to automatically add the methods to your source; this won't make your code more DRY, but it will make it much easier to write (and avoid errors).
Jan 23, 2016 at 2:23 comment added Dirk Boer Hi @svick, thanks for your answer. When I need to implement Equals() GetHashCode and the == and != operators it starts to become quite a large piece of code (per Id). Do you see any way to get it more DRY? In a way I would prefer to just 'inherit' from int.
Jan 23, 2016 at 2:06 history answered svick CC BY-SA 3.0