writing a code that rejects strings and accepts all other datatypes using subtraction method
How do you create a dll file and write a program accepting all values of any datatype except strings using the subtraction method.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
AlanPosted Oct 12, 2008, 2:06 PM
If you mean the subtraction operator ( '-'), then the string class doesn't support it anyway. It is supported by all the numeric types and by other framework types such as DateTime and TimeSpan. It could also be supported by custom types using operator overloading.
However, if you're trying to write a generic subtraction method in a class library, then this is virtually impossible because there's no 'constraint' which ties all these types together. They'll probably all implement IComparable (as do string and char) but there are other types which implement IComparable which do not have a subtraction operator.
What exactly are you trying to achieve here?