这可能是一个非常愚蠢的问题,但是;
如果我正在创建一个数据集,可以说,
[WebMethod(Description = "Returns a Fruit XML")]
public XmlElement GetALLFruits()
{
Fruit fruit = new Fruit();
fruit.Name = "Mango La Ka Buma";
fruit.expiryDate = "11/11/1911";
getFruitCrateDetails(fruit);
return fruit.xml; //just giving example syntax might be wrong
}
public void getFruitCrateDetails(Fruit fruit)
{
FruitCrate crate = new FruitCrate();
crate.id = 999;
Fruit.Crate.add(crate);
// Now here do I need to return "Fruit" object or not ?
}
我有 10 或 20 种方法,我应该将它们保留在方法中还是组合成 1 种大方法。