>>>>It actually also needed closeSalespoint and closeOperator. I sent both as out parameters but I was thinking I may create the above as a class instead with these properties. Do you think it will be a better solution or 4 out parameters is not bad?
>>>
>>>
>>>Dunno - there are several ways
>>>
>>>Viv's personal limit is about 5
>>>Another option mentioned is to have the method return a Tuple - only inconvenience of a tuple is that the properties do not have meaningful names
>>>
>>>Another option suggested is to create a class. I would opt for a private nested class in that case
>>
>>Can you show how the private nested class idea looks like, please?
>>
>It;s just a class declaration within a class.
>
> class TheClass
> {
> public void Work()
> {
>
> PrivateClass hello = new PrivateClass();
>
> hello.DoWork(); // with parameters needed
> Console.WriteLine("{0} {1}", hello.StartTime, hello.EndTime);
> Console.ReadLine();
>
> }
> private class PrivateClass
> {
> public DateTime StartTime { get; private set; }
> public DateTime EndTime { get; private set; }
>
> public void DoWork()
> {
> StartTime = DateTime.Now;
> EndTime = DateTime.Now;
> }
>
> }
>
> }
>
>
I see, thanks a lot - this may be very useful for me.
If it's not broken, fix it until it is.
My Blog