EDIT: Scratch all below the line- as per the comments, that's probably not what you want.
Unfortunately mixins are not available as a built-in language feature in C#, other than through some questionable techniques, including post-compile tools like PostSharp. Some IoC tools can make mixin-like things happen also (see Best implementation of INotifyPropertyChange ever).
To @32bitkid's point, you can write extension methods. They are not interfaces, but they allow you to apply an implementation of a behavior to a type from outside that type. For instance, you can write:
public static class IPersonExtensions {
// Note use of this keyword
public static Int32 GetAge(this IPerson p) { return DateTime.Now - p.BirthDate; }
}
then use it thus:
var p = new Person( ... );
var pAge = p.GetAge();
Yes, that's how interfaces are normally used- though they get .cs files, not .h files. You can define the interface in it's own file, just like a class, and then declare the class as implementing the interface.
For example, in IFoo.cs:
public interface IFoo {
public String Bar { get; set; }
}
and then in ConcreteFoo.cs:
public class ConcreteFoo : IFoo {
// This property implements IFoo.Bar
public String Bar { get; set; }
}
(This is an example of an auto-implemented property by the way)
IFoo doesn't even technically need to be in it's own file- it can be in any .cs file. By convention, it usually is in it's own though. Also, note the convention of using the I prefix for interfaces.
You might want to read more about this, here for example: http://www.csharp-station.com/Tutorials/Lesson13.aspx