You may be trying to access this site from a secured browser on the server. Please enable scripts and reload this page.
Turn on more accessible mode
Turn off more accessible mode
Skip Ribbon Commands
Skip to main content
To navigate through the Ribbon, use standard browser navigation keys. To skip between groups, use Ctrl+LEFT or Ctrl+RIGHT. To jump to the first Ribbon tab use Ctrl+[. To jump to the last selected command use Ctrl+]. To activate a command, use Enter.
Site Actions
This page location is:
Ondrej Sevecek's Blog
Ondrej Sevecek's English Pages
Comments
One further change
Browse
Tab 1 of 2.
View
Tab 2 of 2.
Sign In
Edit
Item
Version History
Manage Permissions
Delete Item
Manage
Ondrej Sevecek's English Pages
Comments
: One further change
Engineering and troubleshooting by Directory Master!
This Site
This List
Home
Currently selected
Contacts
Quick Posts
Quick Launch
Libraries
Site Pages
Pictures
General
Lists
Links
Posts
Comments
Categories
Quick Posts
Discussions
Surveys
All Site Content
Sorry comments are disable due to the constant load of spam
2
Title
One further change
Author
Doug Kaye
(douglas.kaye@outlook.com)
Body
Actually if one of o1 and o2 is a value type and the other is not then my code throws an exception. The following solves that issue;
static new bool Equals(object o1, object o2)
{
if (o1?.GetType().IsValueType.Equals(o2?.GetType().IsValueType) ?? false)
{
System.Reflection.MethodInfo method = o1.GetType().GetMethod("Equals", new Type[] { o1.GetType() });
if (method == null) method = o1.GetType().GetMethod("Equals");
if (method != null)
{
return (bool)method.Invoke(o1, new object[] { o2 });
}
else
return false;
}
else
return (o1 is null && o2 is null);
}
Attachments
Created at 28/09/2018 21:44 by
Last modified at 28/09/2018 21:44 by