java: public boolean equals(Object object) {if (this == object) {return true;}if (object instanceof Set) {Set<?> s = (Set<?>) object;try {return size() == s.size() && containsAll(s);} catch (NullPointerException ignored) {return false;} catch (ClassCastException ignored) {return false;}}return false;}
C#: public override bool Equals(object @object){if (this == @object){return true;}if (@object is java.util.Set<E>){java.util.Set<E> s = (java.util.Set<E>)@object;try{return size() == s.size() && containsAll(s);}catch (System.ArgumentNullException){return false;}catch (System.InvalidCastException){return false;}}return false;}