summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/slice2cs/Gen.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp
index 4dc49f80d59..c012fc1fbae 100644
--- a/cpp/src/slice2cs/Gen.cpp
+++ b/cpp/src/slice2cs/Gen.cpp
@@ -2532,7 +2532,8 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
_out << sb;
_out << nl << "return true;";
_out << eb;
- _out << nl << "if(!(other__ is " << name << "))";
+ _out << nl << name << " o__ = other__ as " << name << ";";
+ _out << nl << "if(o__ == null)";
_out << sb;
_out << nl << "return false;";
_out << eb;
@@ -2543,10 +2544,6 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
_out << nl << "return false;";
_out << eb;
}
- if(!dataMembers.empty())
- {
- _out << nl << name << " o__ = (" << name << ")other__;";
- }
writeMemberEquals(dataMembers, DotNet::Exception);
_out << nl << "return true;";
_out << eb;