Search code examples
c#jsonpostflurl

Ask - How to use the word 'params' in 'PostJsonAsync' Flurl


I am using flurl to retrieve data in the url. How to use the word params in PostJsonAsync? The problem I get is identifier expected: 'params' is keyword, if I use a word other than 'params' there is no problem.

            .PostJsonAsync(new
            {
                variables = (new
                {
                    params = "&ob=23&identifier=handphone-tablet_aksesoris-handphone&sc=66&user_id=0&rows=60&start=1&source=directory&device=desktop&page=1&related=true&st=product&safe_search=false"
                }),
            })

Solution

  • Anytime you want to use a C# reserved word as a property name, just prefix it with @:

    new 
    {
        @params = "..."
    }