コード例 #1
0
        /// <summary>
        /// This method is overridden for Sort() method
        /// </summary>
        /// <param name="obj">instance of object class</param>
        /// <returns>integer result of comparison</returns>
        public int CompareTo(object obj)
        {
            try
            {
                SampleCodeLanguage c = obj as SampleCodeLanguage;
                return(string.Compare(this.LanguageName,
                                      c.LanguageName, StringComparison.Ordinal));
            }
            catch (ArgumentException)
            {
                throw;
            }
            catch (Exception ex)
            {
                string sSource;
                string sLog;
                string sEvent;

                sSource = "ODP API";
                sLog    = "Application";
                sEvent  = ex.Message;

                if (!System.Diagnostics.EventLog.SourceExists(sSource))
                {
                    System.Diagnostics.EventLog.CreateEventSource(sSource, sLog);
                }

                System.Diagnostics.EventLog.WriteEntry(sSource, sEvent);
                System.Diagnostics.EventLog.WriteEntry(sSource, sEvent, System.Diagnostics.EventLogEntryType.Warning, 234);

                throw;
            }
        }
コード例 #2
0
 /// <summary>
 /// This method is overridden for Sort() method
 /// </summary>
 /// <param name="obj">instance of object class</param>
 /// <returns>integer result of comparison</returns>
 public int CompareTo(object obj)
 {
     try
     {
         SampleCodeLanguage c = obj as SampleCodeLanguage;
         return(string.Compare(this.LanguageName,
                               c.LanguageName, StringComparison.Ordinal));
     }
     catch (ArgumentException)
     {
         throw;
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #3
0
        /// <summary>
        /// overriden the method Equals to match the object
        /// of type EntitySet
        /// </summary>
        /// <param name="obj">param of type object</param>
        /// <returns>returns result of match in boolean</returns>
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }

            SampleCodeLanguage sampleCodeLanguage =
                obj as SampleCodeLanguage;

            if (!Object.Equals(this.FilePath, sampleCodeLanguage.FilePath))
            {
                return(false);
            }
            if (!Object.Equals(this.LanguageName, sampleCodeLanguage.LanguageName))
            {
                return(false);
            }
            return(true);
        }