using System;
namespace myComponents
{
public class Quote
{
public static string ShowQuote()
{
Random myRand = new Random();
switch(myRand.Next(3))
{
case 0:
return "Look before you leap";
break;
case 1:
return "Necessity is the mother of invention";
break;
case 2:
return "Life is full of risks";
break;
}
}
}
}调用:Quote.ShowQuote();
namespace myComponents
{
public class Quote
{
public static string ShowQuote()
{
Random myRand = new Random();
switch(myRand.Next(3))
{
case 0:
return "Look before you leap";
break;
case 1:
return "Necessity is the mother of invention";
break;
case 2:
return "Life is full of risks";
break;
}
}
}
}调用:Quote.ShowQuote();
namespace myComponents
{
public class Quote
{
Random myRand = new Random();
public string ShowQuote()
{
switch(myRand.Next(3))
{
case 0:
return "Look before you leap";
case 1:
return "Necessity is the mother of invention";
case 2:
return "Life is full of risks";
default:
return "ERROR";
}
}
}
}