Click here to Skip to main content
15,897,090 members
Home / Discussions / C#
   

C#

 
Questionhow to show ip address client to listview when client connected and shutdown,wakeup client using c# windows forms. Thanks Pin
Member 107057405-Apr-14 22:02
Member 107057405-Apr-14 22:02 
QuestionRe: how to show ip address client to listview when client connected and shutdown,wakeup client using c# windows forms. Thanks Pin
Richard MacCutchan6-Apr-14 1:40
mveRichard MacCutchan6-Apr-14 1:40 
QuestionRoles in c# Winforms Pin
meloukoud5-Apr-14 7:42
meloukoud5-Apr-14 7:42 
QuestionThe dates of the next week and the previous week days Pin
ismail204-Apr-14 21:28
ismail204-Apr-14 21:28 
AnswerRe: The dates of the next week and the previous week days Pin
OriginalGriff4-Apr-14 22:16
mveOriginalGriff4-Apr-14 22:16 
GeneralRe: The dates of the next week and the previous week days Pin
ismail204-Apr-14 23:29
ismail204-Apr-14 23:29 
GeneralRe: The dates of the next week and the previous week days Pin
OriginalGriff4-Apr-14 23:35
mveOriginalGriff4-Apr-14 23:35 
GeneralRe: The dates of the next week and the previous week days Pin
ismail204-Apr-14 23:48
ismail204-Apr-14 23:48 
GeneralRe: The dates of the next week and the previous week days Pin
OriginalGriff5-Apr-14 0:27
mveOriginalGriff5-Apr-14 0:27 
GeneralRe: The dates of the next week and the previous week days Pin
ismail205-Apr-14 0:55
ismail205-Apr-14 0:55 
GeneralRe: The dates of the next week and the previous week days Pin
OriginalGriff5-Apr-14 3:34
mveOriginalGriff5-Apr-14 3:34 
GeneralRe: The dates of the next week and the previous week days Pin
ismail205-Apr-14 4:27
ismail205-Apr-14 4:27 
GeneralRe: The dates of the next week and the previous week days Pin
OriginalGriff5-Apr-14 4:35
mveOriginalGriff5-Apr-14 4:35 
GeneralRe: The dates of the next week and the previous week days Pin
ismail205-Apr-14 4:43
ismail205-Apr-14 4:43 
GeneralRe: The dates of the next week and the previous week days Pin
OriginalGriff5-Apr-14 4:49
mveOriginalGriff5-Apr-14 4:49 
GeneralRe: The dates of the next week and the previous week days Pin
ismail205-Apr-14 4:52
ismail205-Apr-14 4:52 
GeneralRe: The dates of the next week and the previous week days Pin
OriginalGriff5-Apr-14 5:13
mveOriginalGriff5-Apr-14 5:13 
GeneralRe: The dates of the next week and the previous week days Pin
ismail205-Apr-14 5:27
ismail205-Apr-14 5:27 
GeneralRe: The dates of the next week and the previous week days Pin
OriginalGriff5-Apr-14 5:42
mveOriginalGriff5-Apr-14 5:42 
GeneralRe: The dates of the next week and the previous week days Pin
ismail205-Apr-14 5:47
ismail205-Apr-14 5:47 
GeneralRe: The dates of the next week and the previous week days Pin
OriginalGriff5-Apr-14 6:12
mveOriginalGriff5-Apr-14 6:12 
GeneralRe: The dates of the next week and the previous week days Pin
ismail205-Apr-14 6:12
ismail205-Apr-14 6:12 
QuestionAnonymous or static or lambda methods?? Pin
Sea_Sharp4-Apr-14 8:56
Sea_Sharp4-Apr-14 8:56 
AnswerRe: Anonymous or static or lambda methods?? Pin
Mycroft Holmes4-Apr-14 14:20
professionalMycroft Holmes4-Apr-14 14:20 
AnswerRe: Anonymous or static or lambda methods?? Pin
OriginalGriff4-Apr-14 20:55
mveOriginalGriff4-Apr-14 20:55 
The three aren't "very quite similar" - the static method is a different animal altogether from the other two. Anonymous and Lambda methods cannot be static: they are always instance related.

A static method is not instance related: you cannot use the this reference inside a static method explicitly or implicitly - which means you can't access non-static class properties, fields, or methods at all. So you can't do this:
C#
private int myInt = 666;
public static void MyStaticMethod()
   {
   Console.WriteLine(myInt);
   }
Because the compiler will complain that "An object reference is required for the non-static field, method, or property '... .myInt'"

And there is no way to find the object reference because it is never, ever provided for a static method.

If you remove the keyword static from your example, then the three calls become equivalent.

But... you wouldn't normally do that!
The Lambda you use for a very simple method that you are going to do in one place only, and it is frequently used for Linq to process all the elements in a collection - outside that context it's a bit overkill (why not just do the code inline?)

Delegates are different: while you can use them the way you show, you would have to agree it's very "clumsy"! That's partly why Lambdas were introduced with Linq - to give a "cleaner" syntax to doing the same thing, and that's effectively what a Lambda is: an anonymous Delegate!
But Delegates are move powerful that that: you can use the delegate repeatedly, or pass it through to a method. This allows you to write code which calls the delegate to "do something" without knowing exactly what the delegate is going to do! For example, you could set up a method to list out a log from a DB, and give it a delegate which does the actual output - then call the same method to output to the console, a textbox, a file,... without changing the actual method in any way!
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)

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.