日期:2014-05-18  浏览次数:20898 次

各位,我想在c#.net的aspx.cs中添加一个函数,请高手指教。
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Collections.Generic;

public partial class _Default : System.Web.UI.Page 
{
  protected void Page_Load(object sender, EventArgs e)
  {
  //怎样在这个里面写一个子函数或者引用一个子函数,要求把一些数据给子函数,然后子函数还要有返回值,请各位大侠指导。
  }
}

------解决方案--------------------
protected void Page_Load(object sender, EventArgs e)
{
//怎样在这个里面写一个子函数或者引用一个子函数,要求把一些数据给子函数,然后子函数还要有返回值,请各位大侠指导。
string ss= GetStr("bbbbbbb");
}
privite string GetStr(string str){
string s=str+"aaaaaa";
return s;
}

------解决方案--------------------
C# code
private string Fn(string ch, int[] arr)
{
    return "a";
}

protected void Page_Load(object sender, EventArgs e)
{
    int[] array = new int[] { 1, 2, 3 };
    string ss = Fn("aaa", array);
}

------解决方案--------------------
你是不是设置了返回值类型,但是最后没有在函数里边写return啊?~~~~
private string GetStr(string str, int[] n)
{
return "***";这个return有木有??有木有?!!
}
探讨
错误 12 “_Default.yuanshimubiaozhi()”: 并非所有的代码路径都返回值 D:\Documents\Visual Studio 2008\WebSites\WebSite4\Default.aspx.cs 68 17 D:\...\WebSite4\