Does C# allows partial interface? i.e., in ManagerFactory1.cs class, I have
public partial interface IManagerFactory { // Get Methods ITescoManager GetTescoManager(); ITescoManager GetTescoManager(INHibernateSession session); }
and in ManagerFactory.cs class, I have:
public partial interface IManagerFactory { // Get Methods IEmployeeManager GetEmployeeManager(); IEmployeeManager GetEmployeeManager(INHibernateSession session); IProductManager GetProductManager(); IProductManager GetProductManager(INHibernateSession session); IStoreManager GetStoreManager(); IStoreManager GetStoreManager(INHibernateSession session); }
Both ManagerFactory and ManagerFactory1 are located in the same assembly.
In C#, you can split the implementation of an interface into multiple files using the partial keyword. The partial keyword indicates that other parts of the interface can be defined anywhere in the namespace.
But yes, partial interfaces are allowed. Valid locations for the partial modifier (with C# 3.0 spec references): Classes (10.1.
Partial class, interface and structure was introduced in C# 2.0. Now it is possible to split the definition of an class, interface and structure over more than one source files. Moreover the other parts of the class, struct, or interface should be defined in the same namespace or assembly.
Partial Class is a unique feature of C#. It can break the functionality of a single class into many files. When the application is compiled, these files are then reassembled into a single class file. The partial keyword is used to build a partial class.
The simplest way is just to try it :)
But yes, partial interfaces are allowed.
Valid locations for the partial
modifier (with C# 3.0 spec references):
Section 10.2 of the spec contains most of the general details for partial types.
Invalid locations:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With