If (MyControl is MyControlInterface1) { ((MyControlInterface1)MyControl).MyMethod(); ((MyControlInterface1)MyControl).MyProp = ... }BTW, it's pretty standard to preface all interfaces with an "I", but you probably already knew that.
>If (MyControl is MyControlInterface1) >{ > MyControl.MyMethod(); > MyControl.MyProp = ... >}>
>>using System; >>using System.Collections.Generic; >>using System.Text; >> >>namespace Interface1 >>{ >> interface IMessage >> { >> // Send the message. Returns True if success, False otherwise >> bool Send(); >> >> // The message to send >> string Message { get; set; } >> >> // The address to send to >> string Address { get; set; } >> >> } >> >> public class EmailMessage : IMessage >> { >> string _address = ""; >> string _message = ""; >> >> public bool Send() >> { >> bool bRetVal = false; >> return bRetVal; >> } >> >> public string Message >> { >> get >> { >> return _message; >> } >> set >> { >> _message = value; >> } >> } >> >> public string Address >> { >> get >> { >> return _address; >> } >> set >> { >> _address = value; >> } >> } >> >> } >>} >>