我有一个class
,其中有许多return
类型为object
的方法。我想要该return
中所有方法的所有class
值。例如:我有一个名为Class1的类,带有Method1,Method2和Mapactivity,每个method1和2都有switch
case
返回某些枚举值。我想从这两种方法中检索所有return
值。
public static class Class1
{
public static string Mapactivity(Human human,activity activity)
{
switch (human)
{
case Human.Me:
return Method1(activity);
case Human.Him:
return Method2(activity);
default:
return "error";
}
}
public enum activity
{
Eat,Sleep,Game,Drink,Poop,Slack,}
private static string Method1(activity myactivity)
{
switch (myactivity)
{
case activity.Eat:
return "one";
case activity.Sleep:
return "two";
case activity.Drink:
return "three";
case activity.Game:
return "four";
case activity.Poop:
return "five";
case activity.Eat:
return "six";
default:
return "error";
}
}
private static string Method2(activity hisactivity)
{
switch (hisactivity)
{
case activity.Eat:
return "seven";
case activity.Sleep:
return "eight";
case activity.Drink:
return "nine";
case activity.Slack:
return "ten";
case activity.Poop:
return "eleven";
case activity.Game:
return "twelve";
default:
return "error";
}
}
}
public class Class2
{
public void CheckReturnValues()
{
//this is where i want to do my thing
//get all private methods from Class1
//get all return values from those methods
}
}