Click here to Skip to main content
15,893,594 members
Home / Discussions / C#
   

C#

 
AnswerRe: Update bound WPF controls from another thread Pin
Richard Deeming25-Jan-18 9:02
mveRichard Deeming25-Jan-18 9:02 
AnswerRe: Update bound WPF controls from another thread Pin
Pete O'Hanlon25-Jan-18 22:41
mvePete O'Hanlon25-Jan-18 22:41 
QuestionEliminate LINQ for List<int> ? Pin
Member 245846724-Jan-18 19:50
Member 245846724-Jan-18 19:50 
AnswerRe: Eliminate LINQ for List<int> ? Pin
OriginalGriff24-Jan-18 20:16
mveOriginalGriff24-Jan-18 20:16 
SuggestionRe: Eliminate LINQ for List<int> ? Pin
Richard Deeming25-Jan-18 8:56
mveRichard Deeming25-Jan-18 8:56 
AnswerRe: Eliminate LINQ for List<int> ? Pin
BillWoodruff25-Jan-18 23:58
professionalBillWoodruff25-Jan-18 23:58 
GeneralRe: Eliminate LINQ for List<int> ? Pin
#realJSOP30-Jan-18 3:39
mve#realJSOP30-Jan-18 3:39 
GeneralRe: Eliminate LINQ for List<int> ? Pin
BillWoodruff30-Jan-18 6:07
professionalBillWoodruff30-Jan-18 6:07 
QuestionPaint Image on Form with BitBlt? Pin
Darla Fanbridge24-Jan-18 3:12
Darla Fanbridge24-Jan-18 3:12 
AnswerRe: Paint Image on Form with BitBlt? Pin
OriginalGriff24-Jan-18 4:05
mveOriginalGriff24-Jan-18 4:05 
QuestionSQL Connection string ignoring UserID Pin
Member 1240626023-Jan-18 2:02
Member 1240626023-Jan-18 2:02 
AnswerRe: SQL Connection string ignoring UserID Pin
Jochen Arndt23-Jan-18 2:25
professionalJochen Arndt23-Jan-18 2:25 
QuestionHow can i send text to the Devline camera? Pin
Member 1312505222-Jan-18 23:29
Member 1312505222-Jan-18 23:29 
AnswerRe: How can i send text to the Devline camera? Pin
Pete O'Hanlon22-Jan-18 23:31
mvePete O'Hanlon22-Jan-18 23:31 
QuestionWPF C# check if logged on with MS account Pin
Member 798746122-Jan-18 22:50
Member 798746122-Jan-18 22:50 
AnswerRe: WPF C# check if logged on with MS account Pin
Richard Deeming23-Jan-18 0:29
mveRichard Deeming23-Jan-18 0:29 
GeneralRe: WPF C# check if logged on with MS account Pin
Member 798746123-Jan-18 1:03
Member 798746123-Jan-18 1:03 
Questionis there a way to define the signature of a delegate in an interface without defining the signature twice? Pin
joost.versteegen21-Jan-18 23:38
joost.versteegen21-Jan-18 23:38 
Hi,
I have the following code:
C#
class Program
{
  static void Main(string[] args)
  {
    ProductCounterWatcher w = new ProductCounterWatcher();
    ICounterProcessor p = new PrdStandStillDetector();
    w.OnCounterChanged += p.CounterChanged;
    w.Detect();
    w.OnCounterChanged -= p.CounterChanged;
  }
}
//-----------------------------------------------------------------------------------
public class ProductCounter
{
  public int Value { get; set; }
  public DateTime Timestamp { get; set; }

  public override string ToString()
  {
    return string.Format("[ProductCounter:{0},{1}]", Timestamp, Value);
  }
}
//-----------------------------------------------------------------------------------
public interface ICounterProcessor
{
  void CounterChanged(object source, CounterChangedEventArgs e); // <<<----
}
//-----------------------------------------------------------------------------------

public delegate void CounterChangedHandler(object source, CounterChangedEventArgs e); // <<<----
//-----------------------------------------------------------------------------------

public class CounterChangedEventArgs : EventArgs
{
  public ProductCounter Counter { get; set; }

  public CounterChangedEventArgs(ProductCounter counter)
  {
    this.Counter = counter;
  }
}
//-----------------------------------------------------------------------------------
public class PrdStandStillDetector : ICounterProcessor
{
  public void CounterChanged(object source, CounterChangedEventArgs e)
  {
  }
}
//-----------------------------------------------------------------------------------
public class ProductCounterWatcher
{
  public CounterChangedHandler OnCounterChanged;

  public void Detect()
  {
    if (OnCounterChanged != null) OnCounterChanged(this, new CounterChangedEventArgs(new ProductCounter() { Timestamp = DateTime.Now, Value = 1 }));
  }
}

I have to define the procedure signature twice (see <<<--- mark). is there a way to avoid this and thus only define the signature once?
Thanks.
AnswerRe: is there a way to define the signature of a delegate in an interface without defining the signature twice? Pin
Nathan Minier22-Jan-18 1:15
professionalNathan Minier22-Jan-18 1:15 
GeneralRe: is there a way to define the signature of a delegate in an interface without defining the signature twice? Pin
joost.versteegen22-Jan-18 1:31
joost.versteegen22-Jan-18 1:31 
GeneralRe: is there a way to define the signature of a delegate in an interface without defining the signature twice? Pin
Nathan Minier22-Jan-18 2:00
professionalNathan Minier22-Jan-18 2:00 
SuggestionRe: is there a way to define the signature of a delegate in an interface without defining the signature twice? Pin
Richard Deeming22-Jan-18 8:11
mveRichard Deeming22-Jan-18 8:11 
GeneralRe: is there a way to define the signature of a delegate in an interface without defining the signature twice? Pin
joost.versteegen22-Jan-18 21:17
joost.versteegen22-Jan-18 21:17 
QuestionWPF C# Messagebox Result Issue Pin
Derek Kennard21-Jan-18 19:30
professionalDerek Kennard21-Jan-18 19:30 
AnswerRe: WPF C# Messagebox Result Issue Pin
phil.o21-Jan-18 23:03
professionalphil.o21-Jan-18 23:03 

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.