0

在这里我开发了一些功能。但在那之后我看到那里发生了一些未实现的异常。还有一些设置属性。这是代码,

 private void modifyMessage()
    {
        char [] characters_to_removed_from_end = { ' ' };
        String trimmedString = this.message_in.TrimEnd(characters_to_removed_from_end);
        trimmedString = Regex.Replace(trimmedString, @"s\+", "");

        trimmedString = rearrangeMessage(trimmedString);
    }

之后自动生成下面的代码,

 private string rearrangeMessage(string trimmedString)
    {
        throw new NotImplementedException();
    }

    public string message_in { get; set; }
    public string rearrangeMessage { get; set; }
}

我可以将第二个代码放在另一个文件中吗?或者这里发生了什么?

使用完整代码编辑后....

 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Web;
 using System.Web.UI;
 using System.Web.UI.WebControls;
 using System.Configuration;
 using System.Data.SqlClient;
 using System.Text.RegularExpressions;


namespace ViltraSMS.SMSFunction
{
public partial class MooseSeen : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    { 
        // return SMS
string username =     System.Configuration.ConfigurationManager.AppSettings["username"].ToString();
        string password = System.Configuration.ConfigurationManager.AppSettings["password"].ToString();

        int source = int.Parse(Request.QueryString["msisdn"]);
        int dest = int.Parse(Request.QueryString["shortcode"]);
        string message_in = Request.QueryString["msg"];

    }

    //singleton pattern
    internal static ConnectionFactory newinstance()
    {
        try
        {
            return new ConnectionFactory(ConfigurationManager.ConnectionStrings["myConString"].ConnectionString);
        }
        catch (Exception)
        {
            throw;
        }

    }

    private void modifyMessage()
    {
        char [] characters_to_removed_from_end = { ' ' };
        String trimmedString = this.message_in.TrimEnd(characters_to_removed_from_end);
        trimmedString = Regex.Replace(trimmedString, @"s\+", "");

        trimmedString = rearrangeMessage(trimmedString);
    }



    private string rearrangeMessage(string trimmedString)
    {
        throw new NotImplementedException();
    }

    public string message_in { get; set; }
    public string rearrangeMessage { get; set; }

    private String rearrangeMessage(String modifiedMessage)
    {
        char[] characters_to_removed_from_end = { ' ' };
        modifiedMessage = modifiedMessage.TrimEnd(characters_to_removed_from_end);
        modifiedMessage = Regex.Replace(modifiedMessage, @"\n", "");
        modifiedMessage = Regex.Replace(modifiedMessage, @"\r", "");
        //0d & 0a not done



      }
    }
  }
4

1 回答 1

1

做你的课partial。您可以将一个类的定义拆分为多个文件partial class

http://msdn.microsoft.com/en-us/library/wa80x488(v=vs.80).aspx

于 2012-06-05T04:52:43.833 回答