J
Jof
Can anyone help with this problem I'm having.
What I want to do is to create a class (maybe it should be a struct)
which does nothing but hold data. It doesn't have any methods etc..
public class ShippingOptionsDetails
{
public static class SaturdayDelivery
{
public decimal Price;
public int DeliveryID;
}
public static class EuropeanDelivery
{
public decimal Price;
public int DeliveryID;
}
}
What I want to be able to do is to do this...
public ShippingOptionsDetails MyFunction()
{
ShippingOptionsDetails options = new ShippingOptionsDetails();
options.SaturdayDelivery.Price = 3.00;
Return options;
}
However, you cannot do this. C# wants me to:
ShippingOptionsDetails.SaturdayDelivery options = new
ShippingOptionsDetails.SaturdayDelivery();
But I want to return the holding class and not the nested class.
How do I do this?
Many thanks
Jonathan
What I want to do is to create a class (maybe it should be a struct)
which does nothing but hold data. It doesn't have any methods etc..
public class ShippingOptionsDetails
{
public static class SaturdayDelivery
{
public decimal Price;
public int DeliveryID;
}
public static class EuropeanDelivery
{
public decimal Price;
public int DeliveryID;
}
}
What I want to be able to do is to do this...
public ShippingOptionsDetails MyFunction()
{
ShippingOptionsDetails options = new ShippingOptionsDetails();
options.SaturdayDelivery.Price = 3.00;
Return options;
}
However, you cannot do this. C# wants me to:
ShippingOptionsDetails.SaturdayDelivery options = new
ShippingOptionsDetails.SaturdayDelivery();
But I want to return the holding class and not the nested class.
How do I do this?
Many thanks
Jonathan