Click here to Skip to main content
15,792,327 members
Home / Discussions / C#
   

C#

 
GeneralRe: Bottom-Up Datagrid Pin
Mycroft Holmes3-Jun-09 15:18
professionalMycroft Holmes3-Jun-09 15:18 
GeneralRe: Bottom-Up Datagrid Pin
eziksoft3-Jun-09 15:20
eziksoft3-Jun-09 15:20 
Questionabout the interface of C# Pin
mctramp1682-Jun-09 15:24
mctramp1682-Jun-09 15:24 
AnswerRe: about the interface of C# Pin
Christian Graus2-Jun-09 15:52
protectorChristian Graus2-Jun-09 15:52 
AnswerRe: about the interface of C# Pin
Richard Blythe2-Jun-09 17:15
Richard Blythe2-Jun-09 17:15 
GeneralRe: about the interface of C# Pin
EliottA3-Jun-09 3:55
EliottA3-Jun-09 3:55 
GeneralRe: about the interface of C# Pin
Richard Blythe3-Jun-09 5:51
Richard Blythe3-Jun-09 5:51 
AnswerRe: about the interface of C# Pin
Pete O'Hanlon2-Jun-09 22:41
subeditorPete O'Hanlon2-Jun-09 22:41 
Another advantage of interfaces (again assuming you are talking about code constructs and not the UI) is that they provide a well defined contract to program against. In other words, if you know that a certain type supports a certain interface, then you know that it implements the methods on that interface. An example:
public interface IMyInterface
{
  void DoSomething();
}

public class MyInterfaceClass : IMyInterface
{
  public void DoSomething()
  {
    Console.WriteLine("IMyInterface called");
  }
}
Then, you could do something like the following:
public class MyGenericClass<T> where T : IMyInterface, new()
{
  public void CallAMethod()
  {
    T value = new T();
    value.DoSomething();
  }
}
The generic class is constrained to using classes that support the IMyInterface interface, which means you could write code like this:
new MyGenericClass<MyInterfaceClass>().CallAMethod();


"WPF has many lovers. It's a veritable porn star!" - Josh Smith

As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.


My blog | My articles | MoXAML PowerToys | Onyx



AnswerRe: about the interface of C# Pin
Alan Balkany3-Jun-09 6:07
Alan Balkany3-Jun-09 6:07 
GeneralRe: about the interface of C# Pin
mctramp1683-Jun-09 15:37
mctramp1683-Jun-09 15:37 
Questioncross thread operations Pin
spiritboy2-Jun-09 9:58
spiritboy2-Jun-09 9:58 
QuestionRe: cross thread operations Pin
harold aptroot2-Jun-09 10:57
harold aptroot2-Jun-09 10:57 
AnswerRe: cross thread operations Pin
DaveyM692-Jun-09 10:57
professionalDaveyM692-Jun-09 10:57 
GeneralRe: cross thread operations Pin
spiritboy2-Jun-09 13:26
spiritboy2-Jun-09 13:26 
GeneralRe: cross thread operations Pin
Henry Minute2-Jun-09 13:42
Henry Minute2-Jun-09 13:42 
GeneralRe: cross thread operations Pin
S. Senthil Kumar2-Jun-09 20:09
S. Senthil Kumar2-Jun-09 20:09 
GeneralRe: cross thread operations Pin
spiritboy2-Jun-09 13:43
spiritboy2-Jun-09 13:43 
GeneralRe: cross thread operations Pin
harold aptroot2-Jun-09 13:46
harold aptroot2-Jun-09 13:46 
QuestionStored Procedure that returns data with Entity Data Model not working Pin
dfn2-Jun-09 7:10
dfn2-Jun-09 7:10 
AnswerRe: Stored Procedure that returns data with Entity Data Model not working Pin
Henry Minute2-Jun-09 7:55
Henry Minute2-Jun-09 7:55 
GeneralRe: Stored Procedure that returns data with Entity Data Model not working Pin
Luc Pattyn2-Jun-09 8:12
sitebuilderLuc Pattyn2-Jun-09 8:12 
GeneralRe: Stored Procedure that returns data with Entity Data Model not working Pin
EliottA2-Jun-09 11:32
EliottA2-Jun-09 11:32 
AnswerRe: Stored Procedure that returns data with Entity Data Model not working Pin
Luc Pattyn2-Jun-09 7:55
sitebuilderLuc Pattyn2-Jun-09 7:55 
AnswerRe: Stored Procedure that returns data with Entity Data Model not working Pin
dfn3-Jun-09 7:04
dfn3-Jun-09 7:04 
QuestionFlowLayoutPanel docking, unusual behavior. Pin
EliottA2-Jun-09 6:43
EliottA2-Jun-09 6:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.