Click here to Skip to main content
15,915,788 members
Home / Discussions / C#
   

C#

 
AnswerRe: Add Cotrol Problem Pin
Robert Rohde9-Dec-06 4:24
Robert Rohde9-Dec-06 4:24 
QuestionRe: Add Cotrol Problem Pin
MHASSANF10-Dec-06 2:55
MHASSANF10-Dec-06 2:55 
QuestionDoubt on C# virtual functions Pin
jithus9-Dec-06 2:30
jithus9-Dec-06 2:30 
AnswerRe: Doubt on C# virtual functions Pin
Robert Rohde9-Dec-06 2:48
Robert Rohde9-Dec-06 2:48 
GeneralRe: Doubt on C# virtual functions Pin
jithus9-Dec-06 3:35
jithus9-Dec-06 3:35 
GeneralRe: Doubt on C# virtual functions Pin
Robert Rohde9-Dec-06 4:22
Robert Rohde9-Dec-06 4:22 
GeneralRe: Doubt on C# virtual functions Pin
jithus9-Dec-06 6:08
jithus9-Dec-06 6:08 
GeneralRe: Doubt on C# virtual functions Pin
Robert Rohde9-Dec-06 9:16
Robert Rohde9-Dec-06 9:16 
Hi,

explicit interface implementations are nice for interfaces like IClonable. The Clone method of IClonable always returns an object (I know there is also a generic version but thats another story). But in most case you also want a typesafe version. With explicit interface implementation you can implement ICloneable while still supplying a typesafe Clone method:
public class Test : IClonable {
   public Test Clone() {
      //Clone the object
   }

   IClonable.Clone() {
      return this.Clone();
   }
}

So if you call clone on a variable typed to Test you will also get a Test instance while you'll get an object when working on the interface.

Shadowing can also be useful. Lets assume you have an interface which has a Name property. Lets also assume you have some user control which should implement this interface. Now you have the problem that the Name property from the user control (inherited from Control) does have a complete different meaning than the Name property of your interface. You could even break the designer when changing the normal Name property. Thus you could either use explicit interface implementation (see above) or use shadowing. When using the new keyword on your Name property it will look like a normal property and can be used as an implicit interface implementation. But everyone using the Name property from a Control typed variable (like the designer does) still gets the same behaviour as before.

Robert



GeneralRe: Doubt on C# virtual functions Pin
jithus10-Dec-06 3:22
jithus10-Dec-06 3:22 
AnswerRe: Doubt on C# virtual functions Pin
karam chandrabose9-Dec-06 9:23
karam chandrabose9-Dec-06 9:23 
Questionserial communication Pin
George_Lucian9-Dec-06 2:01
George_Lucian9-Dec-06 2:01 
AnswerRe: serial communication Pin
Squeaker9-Dec-06 2:58
Squeaker9-Dec-06 2:58 
QuestionI want to backup SQL SERVER 2000 database and zip it using .NET 1.1 . The application must be connect remote system by using windows authentification is there any website to produce the code in .NET 1.1 in any language(c#.net or vb.net) Pin
haneef19-Dec-06 1:33
haneef19-Dec-06 1:33 
QuestionI have problem vith vs2003 editor when press F5 for output c# with asp web application it returns dialog box like Error while trying to run a project: Unable to start debugging on webserver.you do not have permissions to debug the server. verify you Pin
haneef19-Dec-06 1:25
haneef19-Dec-06 1:25 
QuestionAdding Images Pin
Lakshmi Kiran Reddy9-Dec-06 0:59
Lakshmi Kiran Reddy9-Dec-06 0:59 
JokeBILL AND THE PEARLY GATES Pin
Muammar©9-Dec-06 0:57
Muammar©9-Dec-06 0:57 
Questiondesktop access Pin
amgag9-Dec-06 0:30
amgag9-Dec-06 0:30 
QuestionC++ vs. C#: Developing a highly scalable IOCP server Pin
zulat9-Dec-06 0:29
zulat9-Dec-06 0:29 
Questionnightmare updating the data source:( Pin
Muammar©9-Dec-06 0:26
Muammar©9-Dec-06 0:26 
QuestionBind nested object property in DataGridView [modified] Pin
MBursill8-Dec-06 23:27
MBursill8-Dec-06 23:27 
Questionstooopid problem with my connection:( Pin
Muammar©8-Dec-06 23:26
Muammar©8-Dec-06 23:26 
QuestionMDI - Question Pin
h@s@n8-Dec-06 21:10
h@s@n8-Dec-06 21:10 
AnswerRe: MDI - Question Pin
Muammar©8-Dec-06 21:26
Muammar©8-Dec-06 21:26 
QuestionClasses of .NET Framework Pin
wanlim08178-Dec-06 20:50
wanlim08178-Dec-06 20:50 
AnswerRe: Classes of .NET Framework Pin
Michael P Butler8-Dec-06 21:02
Michael P Butler8-Dec-06 21:02 

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.