Пример #1
0
        /// <summary>
        /// Returns <see langword="true"/> if this object's type is equivalent to the given class as a C# type, and <see langword="false"/> if they are not.
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="classEquivalent"></param>
        /// <returns></returns>
        public static bool IsA(this object obj, java.lang.Class classEquivalent)
        {
            Type objectType = obj.GetType();
            Type eqType     = classEquivalent.EquivalentType();

            return(objectType.Equals(eqType));
        }
Пример #2
0
 /// <summary>
 /// Returns <see langword="true"/> if this class is equivalent to the given C# type, and <see langword="false"/> if it is not.<para/>
 /// This should be used when the instance is a java type via some form of reflection or is passed in as a literal class.
 /// </summary>
 /// <param name="javaClass"></param>
 /// <param name="objectType"></param>
 /// <returns></returns>
 public static bool IsA(this java.lang.Class javaClass, Type objectType)
 {
     return(javaClass.EquivalentType()?.Equals(objectType) ?? false);
 }