Jak: Implementacja interfejsu
Procedura ta służy do wykonywania operacji implementacja interfejsu IntelliSense.Aby uzyskać więcej informacji, zobacz Implementacja interfejsu.
Aby zaimplementować interfejsu w C# z deklaracji za pomocą technologii IntelliSense.
Tworzy aplikację konsoli.
Umieść kursor w po class Program deklaracji.
Typ : IComparable tak aby stał się deklaracji class Program : IComparable.
Aktywacja tagów inteligentnych w obszarze IComparable.Zostaną wyświetlone dwie następujące opcje:
Implementować interfejs "IComparable".
Jawnie implementują interfejs "IComparable".
Wybierz jawnie implementują interfejs "IComparable".
Technologia IntelliSense jest następnie dodaje IComparable.CompareTo metoda interfejsu IComparable klasy programu:
#region IComparable Members
int IComparable.CompareTo(object obj)
{
throw new Exception("The method or operation is not implemented.");
}
#endregion
Aby zaimplementować interfejsu w C# z niejawne deklarowanie za pomocą technologii IntelliSense.
Tworzy aplikację konsoli.
Umieść kursor w po class Program deklaracji.
Typ : IComparable tak aby stał się deklaracji class Program : IComparable.
Aktywacja tagów inteligentnych w obszarze IComparable.Zostaną wyświetlone dwie następujące opcje:
Implementować interfejs "IComparable".
Jawnie implementują interfejs "IComparable".
Wybierz Implementacja interfejsu "IComparable".
Technologia IntelliSense następnie dodać metodę CompareTo z interfejsu IComparable do klasy programu:
#region IComparable Members
public int CompareTo(object obj)
{
throw new Exception("The method or operation is not implemented.");
}
#endregion
Zobacz też
Informacje
Interfejsy (Podręcznik programowania C#)
Jawne implementacji interfejsu (Podręcznik programowania C#)