You can create an interface to add to all of your sub classes and create an extension method to do the actual calculations.
For example, I have this interface:
public interface ICoreProduct
{
decimal Price { get; set; }
decimal Quantity { get; set; }
}
I created a second partial class for product to attach it to that interface
public partial class Product : ICoreProduct
{
}
And then create an extension method for ICoreProduct
public static decimal CalculatePrice(this ICoreProduct product)
{
return product.Price * product.Quantity;
}
You should then be able to do something along those lines:
Product prod = new Product();
prod.Price = 2;
prod.Quantity = 10;
decimal price = prod.CalculatePrice();