小编isl*_*mdi的帖子

Cast object of (string, multidimensional-array) as JSON result in C# Dotnet 5.0

I have a controller that has the following structure/classes:

// model
public class Result
{
    public string Document { get; set; } = "";

    public int[,] Segments { get; set; } = new int[,] { };
}

// controller
public class SearchController : ControllerBase {
    [HttpGet]
    [Route("/api/v1/[controller]")]
    [Produces("application/json")]
    public IActionResult Search(//metadata list)
    {
      try {
            Result result = <service-call-returning Result object>;
            return Ok(result);
      } catch (Exception e) {
            return BadRequest("bad");
      }
    }
}
Run Code Online (Sandbox Code Playgroud)

It seems that it's not able to …

c# asp.net-core asp.net5

5
推荐指数
2
解决办法
963
查看次数

将内部判别联合的实例从 F# 初始化为 C#

我有一个通过 dll 从 F# 导出的可区分联合类型,用于 C#:

type Argument =
  | IntValue
  | FloatValue
  | BoolValue of bool
Run Code Online (Sandbox Code Playgroud)

在C#中我可以初始化类似Argument.NewBoolValue(true),但其他两种类型IntValueFloatValue没有型式通过F#编译器生成的,因此标记为内部的,是有办法来初始化它们在C#中?

c# f# c#-to-f#

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

标签 统计

c# ×2

asp.net-core ×1

asp.net5 ×1

c#-to-f# ×1

f# ×1