The actual return value of a C# method can only ever be a single object instance - a class, or a list, or a double for example - but there are ways to get more values back to the calling method.
First you can encapsulate the values you want in a custom class, which holds just the custom class list value and a decimal.
public class ReturnValue
{
public List<MyClass> List;
public double Value;
}
public ReturnValue MyMethod()
{
ReturnValue ret = new ReturnValue();
...
return ret;
}
That's a little clumsy, but it works.
Then you can use
ref
and
out
parameters on your method:
public bool MyMethod(ref List<MyClass> list, out double d)
{
foreach(MyClass in list)
{
...
}
list = new List<MyClass>();
...
d = 1.23;
return true;
}
This can be a lot more flexible, but looks a little rough and ready sometimes.