typecast-operator

no typecast operator for class in c#?

typecast operator is cool in c++, no such thing in c#? c++ code: class A { int dat; public: A(int num = 0 ) : dat(num) {} operator int() {return dat;} // cast to int }; ...

What's the difference between casting using (Object as TClass) and TClass(Object)

Got an issue where MyObj.classnameis(TMyClass.classname) is true and TMyClass(MyObj) works but (MyObj as TMyclass).doSomething throws a conversion error. I don't really want any help with that junk, although if you want to put it in the comments that'd be super. I just would like to know what the difference between Obj As Class and Cl...

cast operator to base class within a thin wrapper derived class

I have a derived class that's a very thin wrapper around a base class. Basically, I have a class that has two ways that it can be compared depending on how you interpret it so I created a new class that derives from the base class and only has new constructors (that just delegate to the base class) and a new operator==. What I'd like t...