namespace Whatever { public class MySQLDataReader { internal MySQLDataReader() { } } public class MySQLCommand { public MySQLDataReader ExecuteReader() { MySQLDataReader msdr = new MySQLDataReader(); //Do whatever.... return new MySQLDataReader(); } } }Then from another assembly:
Whatever.MySQLCommand msc = new Whatever.MySQLCommand(); Whatever.MySQLDataReader dr = msc.ExecuteReader(); Whatever.MySQLDataReader dr2 = new Whatever.MySQLDataReader(); //Compile error: The type has no constructors defined>Could you elaborate on what you mean by " hide it behind an interface."?
public interface ICustomer { string Name { get; set; } } class Customer: ICustomer { public string Name { get; set; } } public static class CustomerCreator { public static ICustomer CreateCustomer() { Customer c = new Customer() { Name = "Fred" }; return c; } }Then to create:
Whatever.ICustomer cust = Whatever.CustomerCreator.CreateCustomer();First one probably best for your requirements tho....