The meaning of reflection is to provide information on an assembly, type, a method, a constructor or an interface implemented. Every time you run the .NET Reflector, or simply use the dot syntax to explore the members of a class by Intellisense, you use reflection.
Create a Class Library (e.g.: Commons.dll), and define your interface there.
Create a method which checks for the implemented contract interface in a given assembly (or in a group of assemblies, for example in the \AppPathSnapIns directory.
Create some snap-ins, set a reference on the Commons.dll, and create classes which implements it.
The .NET Framework provides functions for the sake of compatibility with unmanaged (COM or C) codes. In this section, I’ll introduce the technique of Platform Invoke (PInvoke).
To identify functions in DLLs, you should know at least the name of the DLL and of the function. Without it, you are doomed, there won’t be any platform invoke.
As no doubt you’ll love it, .NET comes with the support of sending e-mail messages by SMTP. Unfortunately, it can’t act as a mail receiver, but we should overcome the pain and examine how to send emails with it.
The key namespace is System.Net.Mail, and there are two important classes: MailMessage, which represents an e-mail message, and SmtpClient, which provides methods to send it.
First let’s build our message by using the MailMessage class!
Don’t worry about MailAddress, it just takes a string and verifies that it is a valid e-mail address. It also defines some useful properties such as DisplayName or User. Use it instead of just passing a string.