News和NewsDetail 是两个类,我想把算法和类之间的付值代码分别剥离出来,可一直找到好的方法,请大家指点一下!最后的一点分了,全部送了!!!int start=0;                                               //起始点     
int end=num; //读取长度
if(this.ta.Value.Length <=num)
{
newsDetail.TypeID = news.TypeID;
newsDetail.NewsID = news.NewsID;
newsDetail.Content = this.ta.Value.Replace("'","⌒");
newsDetail.ID=1; news.PersistenceProperty.AddChild(newsDetail);
}
else
{
string tempstring = this.ta.Value.Replace("'","⌒");
int i=(int)(Math.Ceiling(this.GetTextAreaLength(ta)/num));
int TextLength = this.GetTextAreaLength(ta);        //保存文本长度

for(int j=1;j<=i+1;j++)
{
int temp=0;

NewsDetail nd = new NewsDetail();
nd.TypeID = news.TypeID;
nd.NewsID =news.NewsID;
nd.ID =j;
if(start+end >TextLength )
{
temp =TextLength-start;
nd.Content =tempstring.Substring(start,temp);
news.PersistenceProperty.AddChild(nd);
break;
}
else 
if(start+end == TextLength)
{
nd.Content =tempstring.Substring(start,end);
news.PersistenceProperty.AddChild(nd);
break;
}

nd.Content =tempstring.Substring(start,end);
start +=end;
news.PersistenceProperty.AddChild(nd); }