小编Web*_*ane的帖子

从c#中的json字符串中查找一个值

这是我的json字符串:

{"loginAccounts": [
    {
        "name": "abc",
        "accountId": "123456",
        "baseUrl": "https://abc.defghi.com/test/t12/remark/123456",
        "isDefault": "true",
        "userName": "Ceilina James",
        "userId": "7c5bat57-850a-5c93-39eb-2015ai9o8822",
        "email": "abc@test.com",
        "siteDescription": ""
    }
]}
Run Code Online (Sandbox Code Playgroud)

我需要"baseUrl"值.如何在C#中找到它?

c# asp.net-mvc json

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

三元运营商未按预期工作

我在这里使用此代码将结果显示为偶数或奇数而不是true和false:

Console.WriteLine(" is " + result == true ? "even" : "odd");
Run Code Online (Sandbox Code Playgroud)

因此我使用三元运算符,但它抛出错误,一些语法问题在这里,但我无法捕捉它.提前致谢

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

    namespace ConsoleApplicationForTesting
    {
        delegate int Increment(int val);
        delegate bool IsEven(int v);

 class lambdaExpressions
    {
        static void Main(string[] args)
        {

          Increment Incr = count => count + 1;

          IsEven isEven = n => n % 2 == 0;


           Console.WriteLine("Use incr lambda expression:");
           int x = -10;
           while (x <= 0)
           {
               Console.Write(x + " ");
               bool result = isEven(x);
               Console.WriteLine(" …
Run Code Online (Sandbox Code Playgroud)

c#

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

标签 统计

c# ×2

asp.net-mvc ×1

json ×1