我有我從Java轉換的C#代碼。在此,我得到的錯誤「未實現inteface成員System.Collections.IComparer.Comparer(對象,obkject)」不實現接口錯誤
請幫助我解決這個錯誤
internal class CompositeComparator : IComparer
{
private IComparer major;
private IComparer minor;
public CompositeComparator(IComparer major, IComparer minor)
{
this.major = major;
this.minor = minor;
}
public virtual int compare(object o1, object o2)
{
int result = major.Compare(o1, o2);
if (result != 0)
{
return result;
}
else
{
return minor.Compare(o1, o2);
}
}
}
internal class ComparatorIStep : IComparer
{
public ComparatorIStep()
{
}
public virtual int compare(object o1, object o2)
{
int nReturn = ((LogMessage)o1).IStep - ((LogMessage)o2).IStep;
return nReturn;
}
}
internal class ComparatorType : IComparer
{
public ComparatorType()
{
}
public virtual int compare(object o1, object o2)
{
int nReturn = 0;
LogMessage lm1 = (LogMessage)o1;
LogMessage lm2 = (LogMessage)o2;
bool b1 = lm1.isHeading;
bool b2 = lm2.isHeading;
if (b1 || !b2)
{
nReturn = -1;
}
else if (!b1 || b2)
{
nReturn = 1;
}
感謝。
C#is case sens itive - 將'compare'更改爲'Compare'。 – RPM1984 2010-10-22 04:37:59