KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I recently discovered that structs in C# can have methods. Quite accidentally, I found myself to have been using the static method of an empty struct in my code, rather than the static method of a static class that I thought I was working with! e.g. public struct Foo { public static void Bar(Param param) { ... } } It's not really being used as a struct at this point, as it has no properties at all! Is this very different from using a static method of a class (static or otherwise)? Are there any reasons to prefer one over the other? (My gut tells me that using the static struct method is, at minimum, less intuitive)
Tags (comma-separated)
Save Edits
Cancel