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

C#

 
GeneralRe: CreateInstanceAndUnwrap -- File or Dependency Not Found Pin
Heath Stewart8-Mar-04 4:28
protectorHeath Stewart8-Mar-04 4:28 
GeneralRe: CreateInstanceAndUnwrap -- File or Dependency Not Found Pin
Matthew Hazlett8-Mar-04 9:07
Matthew Hazlett8-Mar-04 9:07 
GeneralRe: CreateInstanceAndUnwrap -- File or Dependency Not Found Pin
Nick Parker8-Mar-04 9:19
protectorNick Parker8-Mar-04 9:19 
GeneralRe: CreateInstanceAndUnwrap -- File or Dependency Not Found Pin
leppie8-Mar-04 7:14
leppie8-Mar-04 7:14 
GeneralRe: CreateInstanceAndUnwrap -- File or Dependency Not Found Pin
Matthew Hazlett8-Mar-04 9:06
Matthew Hazlett8-Mar-04 9:06 
GeneralRe: CreateInstanceAndUnwrap -- File or Dependency Not Found Pin
Matthew Hazlett8-Mar-04 16:35
Matthew Hazlett8-Mar-04 16:35 
GeneralRe: CreateInstanceAndUnwrap -- File or Dependency Not Found Pin
leppie9-Mar-04 6:20
leppie9-Mar-04 6:20 
Question.NET interfaces - why doesn't this work? Pin
Judah Gabriel Himango7-Mar-04 19:00
sponsorJudah Gabriel Himango7-Mar-04 19:00 
I'm not looking for a solution to a problem; I want to know why .NET won't allow the following:

interface IFoo
{
   void Invalidate();
}

class FooBar
{
   private System.Windows.Form winForm;
   private IFoo theFoo;

   ...
   theFoo = winForm;
}


On the call theFoo = winForm, the compiler complains that an explicit cast is required. Why? winForm has an .Invalidate method, so why bother? Of course, an explicit cast generates a runtime error. Again, why? If a class implements all methods required by a particular interface without actually implementing the interface, why is an exception thrown? At the very least, an explicit cast should work (even though the compiler could verify and do implicit casts).

Could someone shed some light on why it is designed this way?


---------------------------
He who knows that enough is enough will always
have enough.

-Lao Tsu

AnswerRe: .NET interfaces - why doesn't this work? Pin
Meysam Mahfouzi8-Mar-04 0:02
Meysam Mahfouzi8-Mar-04 0:02 
GeneralRe: .NET interfaces - why doesn't this work? Pin
Judah Gabriel Himango8-Mar-04 4:32
sponsorJudah Gabriel Himango8-Mar-04 4:32 
AnswerRe: .NET interfaces - why doesn't this work? Pin
Werdna8-Mar-04 4:20
Werdna8-Mar-04 4:20 
AnswerRe: .NET interfaces - why doesn't this work? Pin
Heath Stewart8-Mar-04 4:22
protectorHeath Stewart8-Mar-04 4:22 
GeneralRe: .NET interfaces - why doesn't this work? Pin
Judah Gabriel Himango8-Mar-04 8:48
sponsorJudah Gabriel Himango8-Mar-04 8:48 
GeneralRe: .NET interfaces - why doesn't this work? Pin
Tom Larsen8-Mar-04 9:24
Tom Larsen8-Mar-04 9:24 
GeneralRe: .NET interfaces - why doesn't this work? Pin
Judah Gabriel Himango8-Mar-04 10:08
sponsorJudah Gabriel Himango8-Mar-04 10:08 
GeneralRe: .NET interfaces - why doesn't this work? Pin
Heath Stewart8-Mar-04 10:22
protectorHeath Stewart8-Mar-04 10:22 
AnswerRe: .NET interfaces - why doesn't this work? Pin
Tom Larsen8-Mar-04 9:13
Tom Larsen8-Mar-04 9:13 
GeneralRe: .NET interfaces - why doesn't this work? Pin
Judah Gabriel Himango8-Mar-04 10:04
sponsorJudah Gabriel Himango8-Mar-04 10:04 
GeneralRe: .NET interfaces - why doesn't this work? Pin
Nick Parker8-Mar-04 17:57
protectorNick Parker8-Mar-04 17:57 
Generalloop error Pin
ASGill7-Mar-04 16:42
ASGill7-Mar-04 16:42 
GeneralRe: loop error Pin
Judah Gabriel Himango7-Mar-04 16:51
sponsorJudah Gabriel Himango7-Mar-04 16:51 
GeneralRe: loop error Pin
ASGill7-Mar-04 18:06
ASGill7-Mar-04 18:06 
GeneralRe: loop error Pin
Judah Gabriel Himango7-Mar-04 18:51
sponsorJudah Gabriel Himango7-Mar-04 18:51 
GeneralRe: loop error Pin
Dave Kreskowiak8-Mar-04 3:01
mveDave Kreskowiak8-Mar-04 3:01 
GeneralRe: loop error Pin
ASGill8-Mar-04 3:15
ASGill8-Mar-04 3:15 

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.