小编myW*_*rld的帖子

反序列化期间出现异常

运行以下代码时收到此消息:

XML文档中存在错误(6,22).

namespace N1
{
    public class InputEntry
    {
        //FieldName is a class tht is generated from an XSD which has complex type Name and value
        private Field fields;
        public Field[] Fields
        {
            get { return this.fields; }
            set { this.fields= value; }
        }

        public string FieldName
        {
           get{return this.fieldName;}
           set { this.fieldName = value; }
        }

       public string FieldValue
       {
        get {return this.fieldValue; }
        set {this.fieldValue = value;}
       }
    }

    public class B
    {
        public void Method1()
        {
            InputEntry …
Run Code Online (Sandbox Code Playgroud)

.net c# serialization

2
推荐指数
1
解决办法
1174
查看次数

用\替换\

我有一个字符串.我想搜索一个斜杠,然后用"\"(双斜杠)替换"\"(单斜杠).

string Method1(string s) 
{
     string upadtedString = s;
     if (s.Contains("\\"))
     {
      //do nothing
     }
     else if(s.Contains("\"))
     {
          string s1 = "\";
          string s2 = "\\";
          upadtedString.Replace(s1,s2);
          s = upadtedString;
     }
     return s;
 } 
Run Code Online (Sandbox Code Playgroud)

`

c# replace

1
推荐指数
1
解决办法
1327
查看次数

标签 统计

c# ×2

.net ×1

replace ×1

serialization ×1