My method
await ctx.HttpRequestAsync("cancel build", async (http, log) =>
{
var response = await http
.Patch($"{host}/v0.1/apps/{userName}/{appName}/builds/{buildId}")
.SetXApiTokenHeader(xApiToken)
.SetCustomHeader("diagnostic-context", diagnosticContext)
.SetCustomHeader("internal-request-source", internalRequestSource)
.SendAndReceiveAsJsonAsync<BuildCreateModel>();
Class BuildCreateModel
public string sourceVersion { get; set; }
But Intelisense shows error
int.TryParse(jsonData.sourceVersion, out sourceVersion)
How to fix this problem?
CodePudding user response:
You can't pass a property as a reference variable.
Rewrite the code to something like this:
if(int.TryParse(jsonData.sourceVersion, out var sv))
{
sourceVersion = sv;
}