-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: Sijin
Message 4 in Discussion

 Dear Saurabh,   Intresting question. Since interfaces can be implemented by both 
Reference and Value Types, it needs to support both semantics depending on the type 
that is implementing the interface.   To test this out i created a form with two 
propertyGrids and the following interfaces and classses    
public interface ITest 
{ 
} 
public class TestClass : ITest 
{ 
} 
public struct TestStruct : ITest 
{ 
} 
  
As you can see TestClass is a Ref type and TestStruct is a Value type. 
i wrote this code in the Form_load event 
private void Form1_Load(object sender, System.EventArgs e) 
{  
TestClass tc = new TestClass(); 
ITest itc = (ITest)tc; 
propertyGrid1.SelectedObject = itc.GetType(); 
  
TestStruct ts = new TestStruct(); 
ITest its = (ITest)ts; 
propertyGrid2.SelectedObject = its.GetType(); 
 
} 
  
When we run the app we see that,  
itc.ValueType is false and its.ValueType is true. 
So interface is a has the same semantics as the type that implements the interface. 
  
Hope that answers your query.   :) 
Sijin Joseph 
http://www.indiangeek.net 
http://weblogs.asp.net/sjoseph 
 

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to