Click here to Skip to main content
15,888,454 members
Home / Discussions / C#
   

C#

 
AnswerRe: How does the method work ? Pin
Steve Westbrook5-Feb-10 9:08
Steve Westbrook5-Feb-10 9:08 
GeneralRe: How does the method work ? Pin
Mohammad Dayyan5-Feb-10 9:14
Mohammad Dayyan5-Feb-10 9:14 
AnswerRe: How does the method work ? Pin
Luc Pattyn5-Feb-10 9:23
sitebuilderLuc Pattyn5-Feb-10 9:23 
GeneralRe: How does the method work ? Pin
Mohammad Dayyan5-Feb-10 9:27
Mohammad Dayyan5-Feb-10 9:27 
GeneralRe: How does the method work ? Pin
Mohammad Dayyan5-Feb-10 9:35
Mohammad Dayyan5-Feb-10 9:35 
AnswerRe: How does the method work ? Pin
Luc Pattyn5-Feb-10 10:02
sitebuilderLuc Pattyn5-Feb-10 10:02 
GeneralRe: How does the method work ? Pin
Mohammad Dayyan5-Feb-10 10:10
Mohammad Dayyan5-Feb-10 10:10 
AnswerRe: How does the method work ? Pin
Pete O'Hanlon5-Feb-10 10:04
mvePete O'Hanlon5-Feb-10 10:04 
this(execute, null) passes the call through to the second constructor - setting the predicate to null. As you can't call a constructor by name, you need to do this to actually call the second constructor. As you know, in a method, you can do the following:
public void DoThis(int index)
{
  DoThis(index, null);
}

public void DoThis(int index, string message)
{
}
While it would be nice to do this with a constructor, you can't:
public MyClass()
{
  MyClass(null);
}

public MyClass(string message)
{
}
In order to get the same effect, you modify the constructor definition instead.
public MyClass() : this(null)
{
}

public MyClass(string message)
{
}
Now, this differs from calling base which invokes a method on the parent class, rather than this class. What you can't do, is combine this and base in a constructor - it's one or the other.

"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



GeneralRe: How does the method work ? Pin
Mohammad Dayyan5-Feb-10 10:09
Mohammad Dayyan5-Feb-10 10:09 
QuestionApplication updates Pin
Jeroen De Dauw5-Feb-10 8:47
Jeroen De Dauw5-Feb-10 8:47 
AnswerRe: Application updates Pin
Giorgi Dalakishvili5-Feb-10 8:57
mentorGiorgi Dalakishvili5-Feb-10 8:57 
QuestionFind network service address Pin
adrya5-Feb-10 4:44
adrya5-Feb-10 4:44 
AnswerRe: Find network service address Pin
Dave Kreskowiak5-Feb-10 7:16
mveDave Kreskowiak5-Feb-10 7:16 
QuestionControl pc by voice command Pin
Basudevkuet5-Feb-10 4:41
Basudevkuet5-Feb-10 4:41 
AnswerRe: Control pc by voice command Pin
OriginalGriff5-Feb-10 4:45
mveOriginalGriff5-Feb-10 4:45 
GeneralRe: Control pc by voice command Pin
Basudevkuet5-Feb-10 5:54
Basudevkuet5-Feb-10 5:54 
GeneralRe: Control pc by voice command Pin
Smithers-Jones5-Feb-10 6:17
Smithers-Jones5-Feb-10 6:17 
AnswerRe: Control pc by voice command Pin
EliottA5-Feb-10 4:50
EliottA5-Feb-10 4:50 
AnswerRe: Control pc by voice command Pin
Keith Barrow5-Feb-10 4:50
professionalKeith Barrow5-Feb-10 4:50 
GeneralRe: Control pc by voice command Pin
Basudevkuet5-Feb-10 6:10
Basudevkuet5-Feb-10 6:10 
GeneralRe: Control pc by voice command Pin
Dave Kreskowiak5-Feb-10 7:14
mveDave Kreskowiak5-Feb-10 7:14 
GeneralRe: Control pc by voice command Pin
Keith Barrow5-Feb-10 10:00
professionalKeith Barrow5-Feb-10 10:00 
AnswerRe: Control pc by voice command Pin
#realJSOP5-Feb-10 5:34
mve#realJSOP5-Feb-10 5:34 
GeneralRe: Control pc by voice command Pin
Basudevkuet5-Feb-10 6:14
Basudevkuet5-Feb-10 6:14 
GeneralRe: Control pc by voice command Pin
Smithers-Jones5-Feb-10 6:18
Smithers-Jones5-Feb-10 6:18 

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.