小编Ped*_*pes的帖子

将多个json反序列化为对象c#

我正在尝试从具有多个对象的 API 调用中反序列化 json 字符串,但没有取得太大成功。

JSON:

@{
    "purchaseOrders": [
        {
            "supplierId": "500",
            "currencyCode": "EUR",
            "companyId": "LALA",
            "companyName": "LALA",
            "purchaseOrderLines": [
                {
                    "lineNumber": "10",
                    "itemNumber": "255",
                    "itemDescription": "TestItem2",
                    "unitPrice": 24.64,
                    "quantity": 2,
                    "isServiceBased": false,
                    "taxIndicator1": "LAAA5",
                    "taxIndicator2": "4",
                    "unit": "-",
                    "deliveryLines": [],
                    "supplierItems": [],
                    "isActive": true
                },
                {
                    "lineNumber": "20",
                    "itemNumber": "5555555",
                    "itemDescription": "3test, Ind",
                    "unitPrice": 32.56,
                    "quantity": 2,
                    "isServiceBased": false,
                    "taxIndicator1": "LAAA5",
                    "taxIndicator2": "4",
                    "unit": "-",
                    "deliveryLines": [],
                    "supplierItems": [],
                    "isActive": true
                }
            ],
            "orderIdentifier": "261656",
            "supplierName": "Lopes BVBA",
            "orderType": …
Run Code Online (Sandbox Code Playgroud)

c# serialization json

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

溢出时下拉不工作:隐藏

所以即时通讯我的网站上的导航栏有问题.我希望能够在单击导航栏meny项目时显示额外导航栏菜单项的下拉列表.我遇到的问题是.溢出时导航栏没有显示:隐藏我的css类,当我删除它时,我制作的整个导航栏布局变得混乱.我不需要做什么才能解决这个问题.

导航条代码:

.headerclass {
  background-color: #ffffff;
  max-width: 1280px;
  min-width: 1200px;
}

.logotest {
  margin-top: -2%;
  width: 85px;
  height: 40px;
  margin-left: 4%;
  margin-bottom: 1.5%;
}

.testlayout {
  list-style-type: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: #ffffff;
  border-bottom: solid 1px;
  border-top: solid 1px;
}

li {
  float: left;
}

li a {
  display: block;
  color: rgb(110, 110, 120);
  text-align: center;
  padding: 13px 50px;
  text-decoration: none;
  border-right: solid 1px;
}

li a:hover {
  text-decoration: none;
  color: #0099cc;
}

.active {
  background: #0099cc; …
Run Code Online (Sandbox Code Playgroud)

html css twitter-bootstrap

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

将 XDocument 转换为字符串,不添加 /r /n

你好,我正在尝试找到一种方法将我的 XDocument 转换为字符串,以便我可以通过 ajax 调用将其发送回来。

所以我有一个 XDocument 如下

   var xml = new XDocument(
            new XElement("Contract",
                new XAttribute("version", "1.0"),
                new XElement("child", "Hello World!")));
Run Code Online (Sandbox Code Playgroud)

我可以执行以下操作将其转换为字符串

string i = xml.Document.ToString();
Run Code Online (Sandbox Code Playgroud)

但是,通过这样做,我的 xml 文档出现错误,因为 alof ot /r/n 和很多“/”被整体添加。有没有办法将 XDocument 转换为字符串而不需要此附加值?

我得到的字符串

"<Contract version=\"1.0\">\r\n  <child>Hello World!</child>\r\n</Contract>"
Run Code Online (Sandbox Code Playgroud)

.net xml linq-to-xml

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

标签 统计

.net ×1

c# ×1

css ×1

html ×1

json ×1

linq-to-xml ×1

serialization ×1

twitter-bootstrap ×1

xml ×1