QueryAttribute Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Defines a query string to be used in the API request.
public ref class QueryAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Parameter)]
[System.Diagnostics.Conditional("CODE_GENERATION_ATTRIBUTES")]
public sealed class QueryAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Parameter)>]
[<System.Diagnostics.Conditional("CODE_GENERATION_ATTRIBUTES")>]
type QueryAttribute = class
inherit Attribute
Public NotInheritable Class QueryAttribute
Inherits Attribute
- Inheritance
- Attributes
Examples
[AutoClient("MyClient")]
interface IMyDependencyClient
{
[Get("/api/users")]
Task<string> GetUsersAsync([Query] string userName, [Query("id")] string userId, CancellationToken cancellationToken = default);
}
Remarks
Marks a method parameter as a query string for the request.
Constructors
QueryAttribute() |
Initializes a new instance of the QueryAttribute class. |
QueryAttribute(String) |
Initializes a new instance of the QueryAttribute class. |
Properties
Key |
Gets the query key, if set. |
Applies to
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.