TechGuy
TechGuy

Reputation: 4570

Put get set properties in another file

Here i develop some function.but after that i saw some notimplemented exception occured there.and also some get set properties.here is the code,

 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);
    }

After this automatically generate below code,

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

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

can i put second code in another file ? or what happen here ?

POST EDITED WITH FULL CODE....

 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



      }
    }
  }

Upvotes: 0

Views: 317

Answers (1)

Shyju
Shyju

Reputation: 218772

Make your class partial. You can split the definition of a class to more than one file with partial class

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

Upvotes: 1

Related Questions