Click here to Skip to main content
15,887,135 members
Home / Discussions / C#
   

C#

 
AnswerRe: Solution Explorer to be shown on the toolbar Pin
Pete O'Hanlon7-May-13 8:16
mvePete O'Hanlon7-May-13 8:16 
AnswerRe: Solution Explorer to be shown on the toolbar Pin
Anna King8-May-13 3:07
professionalAnna King8-May-13 3:07 
GeneralRe: Solution Explorer to be shown on the toolbar Pin
Pete O'Hanlon8-May-13 3:47
mvePete O'Hanlon8-May-13 3:47 
QuestionBackground worker with progress bar timing issue Pin
Blubbo7-May-13 5:02
Blubbo7-May-13 5:02 
AnswerRe: Background worker with progress bar timing issue Pin
Eddy Vluggen7-May-13 9:28
professionalEddy Vluggen7-May-13 9:28 
AnswerRe: Background worker with progress bar timing issue Pin
Matt T Heffron7-May-13 11:31
professionalMatt T Heffron7-May-13 11:31 
GeneralRe: Background worker with progress bar timing issue Pin
Blubbo8-May-13 8:18
Blubbo8-May-13 8:18 
SuggestionRe: Background worker with progress bar timing issue Pin
Matt T Heffron8-May-13 8:50
professionalMatt T Heffron8-May-13 8:50 
I think you should just create the delegate once as it doesn't change. And the BeginInvoke's second argument is params so it will assemble the object array automatically, so this might be easier to read:
C#
private static Action<ProgressBar, int> UpdateProgressBarAction = UpdateProgressBar;
private static void UpdateProgressBar(ProgressBar pb, int value)
{
  if (pb.InvokeRequired)
  {
    pb.BeginInvoke(UpdateProgressBarAction, pb, value);
  }
  else
    pb.Value = value;
}

You could even use a lambda to define this self-referentially to avoid the separate UpdateProgressBarAction:
C#
private static Action<ProgressBar, int> UpdateProgressBar = (ProgressBar pb, int value) => {
  if (pb.InvokeRequired)
  {
    pb.BeginInvoke(UpdateProgressBar, pb, value);
  }
  else
    pb.Value = value;
};

GeneralRe: Background worker with progress bar timing issue Pin
Blubbo8-May-13 9:11
Blubbo8-May-13 9:11 
Questionnetwork programming Pin
Member 100297487-May-13 4:53
Member 100297487-May-13 4:53 
AnswerRe: network programming Pin
Richard MacCutchan7-May-13 4:59
mveRichard MacCutchan7-May-13 4:59 
GeneralRe: network programming Pin
Ennis Ray Lynch, Jr.7-May-13 7:33
Ennis Ray Lynch, Jr.7-May-13 7:33 
GeneralRe: network programming Pin
Richard MacCutchan7-May-13 20:34
mveRichard MacCutchan7-May-13 20:34 
AnswerRe: network programming Pin
Anna King8-May-13 3:19
professionalAnna King8-May-13 3:19 
QuestionEthernet Port C# Pin
Member 100344047-May-13 2:28
Member 100344047-May-13 2:28 
AnswerRe: Ethernet Port C# Pin
Richard MacCutchan7-May-13 2:51
mveRichard MacCutchan7-May-13 2:51 
QuestionSaving objects with Cross-reference Pin
larsp7777-May-13 1:35
larsp7777-May-13 1:35 
AnswerRe: Saving objects with Cross-reference Pin
Eddy Vluggen7-May-13 9:22
professionalEddy Vluggen7-May-13 9:22 
GeneralRe: Saving objects with Cross-reference Pin
larsp7777-May-13 12:14
larsp7777-May-13 12:14 
GeneralRe: Saving objects with Cross-reference Pin
Bernhard Hiller7-May-13 22:56
Bernhard Hiller7-May-13 22:56 
GeneralRe: Saving objects with Cross-reference Pin
larsp7778-May-13 2:24
larsp7778-May-13 2:24 
GeneralRe: Saving objects with Cross-reference Pin
Eddy Vluggen8-May-13 6:53
professionalEddy Vluggen8-May-13 6:53 
GeneralRe: Saving objects with Cross-reference Pin
larsp7779-May-13 20:19
larsp7779-May-13 20:19 
GeneralRe: Saving objects with Cross-reference Pin
Eddy Vluggen11-May-13 9:40
professionalEddy Vluggen11-May-13 9:40 
GeneralRe: Saving objects with Cross-reference Pin
larsp77711-May-13 10:57
larsp77711-May-13 10:57 

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.