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

C#

 
AnswerRe: How to return a collection from a method. Pin
#realJSOP9-Jun-10 7:47
mve#realJSOP9-Jun-10 7:47 
JokeRe: How to return a collection from a method. Pin
Andrew Rissing9-Jun-10 7:55
Andrew Rissing9-Jun-10 7:55 
GeneralRe: How to return a collection from a method. Pin
#realJSOP9-Jun-10 8:26
mve#realJSOP9-Jun-10 8:26 
AnswerRe: How to return a collection from a method. Pin
dan!sh 9-Jun-10 7:54
professional dan!sh 9-Jun-10 7:54 
AnswerRe: How to return a collection from a method. Pin
srng.net9-Jun-10 20:04
srng.net9-Jun-10 20:04 
QuestionRemoting with XMLSerializable objects Pin
andyknapp9-Jun-10 4:34
andyknapp9-Jun-10 4:34 
AnswerRe: Remoting with XMLSerializable objects Pin
mud779-Jun-10 9:43
mud779-Jun-10 9:43 
QuestionError casting delegate in non-generic class PinPopular
Kalvin @ Work9-Jun-10 4:19
Kalvin @ Work9-Jun-10 4:19 
I started with a generic class which has a delegate. The consumer of this class could set a method callback which requires invoking but they may not also. To address this I check if the callback is ISyncronizeInvoke, if it is then I will call BeginInvoke. This works great as long as the class is a generic class:

public class TestClassGeneric<T>
  {
    public delegate void GetMe();
    private GetMe _call;

    public TestClassGeneric(GetMe theCall)
    {
      _call = theCall;

      System.ComponentModel.ISynchronizeInvoke si =
        _call as System.ComponentModel.ISynchronizeInvoke;
    }
 }


Since I don't need the class to be generic I want to make it just a standard class:
public class TestClassGeneric
  {
    public delegate void GetMe();
    private GetMe _call;

    public TestClassGeneric(GetMe theCall)
    {
      _call = theCall;

      System.ComponentModel.ISynchronizeInvoke si =
        _call as System.ComponentModel.ISynchronizeInvoke;
    }
  }


But then I get a compile error:
"Cannot convert type 'PureLibrary.TestClassGeneric.GetMe' to 'System.ComponentModel.ISynchronizeInvoke' via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null type conversion"

Could someone please help me understand why this makes such a difference? Since the delegate signature didn't change it seems the casting would be the same.

Thank you.
- Kalvin

AnswerRe: Error casting delegate in non-generic class [modified] PinPopular
Dimitri Witkowski9-Jun-10 8:05
Dimitri Witkowski9-Jun-10 8:05 
QuestionLogin dialog on Page loads Pin
Ramkithepower9-Jun-10 3:59
Ramkithepower9-Jun-10 3:59 
QuestionC# datagridview cell focus Pin
jojoba20119-Jun-10 3:09
jojoba20119-Jun-10 3:09 
AnswerRe: C# datagridview cell focus Pin
Henry Minute9-Jun-10 7:17
Henry Minute9-Jun-10 7:17 
QuestionRe: C# datagridview cell focus Pin
jojoba20119-Jun-10 7:48
jojoba20119-Jun-10 7:48 
AnswerRe: C# datagridview cell focus Pin
Henry Minute9-Jun-10 12:57
Henry Minute9-Jun-10 12:57 
AnswerRe: C# datagridview cell focus Pin
Henry Minute10-Jun-10 3:24
Henry Minute10-Jun-10 3:24 
AnswerRe: C# datagridview cell focus Pin
dan!sh 9-Jun-10 7:55
professional dan!sh 9-Jun-10 7:55 
QuestionRe: C# datagridview cell focus Pin
jojoba20119-Jun-10 8:27
jojoba20119-Jun-10 8:27 
GeneralRe: C# datagridview cell focus Pin
Henry Minute9-Jun-10 10:06
Henry Minute9-Jun-10 10:06 
AnswerRe: C# datagridview cell focus Pin
Dr.Walt Fair, PE9-Jun-10 10:46
professionalDr.Walt Fair, PE9-Jun-10 10:46 
GeneralRe: C# datagridview cell focus Pin
Henry Minute9-Jun-10 11:37
Henry Minute9-Jun-10 11:37 
GeneralRe: C# datagridview cell focus Pin
Dr.Walt Fair, PE9-Jun-10 13:36
professionalDr.Walt Fair, PE9-Jun-10 13:36 
QuestionC# how to keep datetimes independent of regional settings Pin
MayukhSen9-Jun-10 2:01
MayukhSen9-Jun-10 2:01 
AnswerRe: C# how to keep datetimes independent of regional settings Pin
DaveyM699-Jun-10 2:05
professionalDaveyM699-Jun-10 2:05 
AnswerRe: C# how to keep datetimes independent of regional settings Pin
OriginalGriff9-Jun-10 2:16
mveOriginalGriff9-Jun-10 2:16 
AnswerRe: C# how to keep datetimes independent of regional settings Pin
Pete O'Hanlon9-Jun-10 2:36
mvePete O'Hanlon9-Jun-10 2:36 

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.