KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Is it possible to implement basic arithmetic (at least addition) in C# generics, like you can with C++ templates ? I've been trying for a while to get them up and working, but C# doesn't let you declare the same generic type multiple times, like you can with templates. Extensive googling did not provide an answer. EDIT: Thanks, but what I'm looking for is a way to do the arithmetic at compile time, embedding something like Church numerals in generics types. That's why I linked the article that I did. Arithmetic in generic types, not arithmetic on instances of generic types.
Tags (comma-separated)
Save Edits
Cancel