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
Συνεργαστείτε μαζί μας στο GitHub
Μπορείτε να βρείτε την πηγή για αυτό το περιεχόμενο στο GitHub, όπου μπορείτε επίσης να δημιουργήσετε και να εξετάσετε ζητήματα και αιτήματα έλξης. Για περισσότερες πληροφορίες, ανατρέξτε στον οδηγό συνεργατών.