GraphQLVariable
Namespace: GraphQL.Query.Builder
Represents a GraphQL variable declaration.
public class GraphQLVariable
Inheritance Object → GraphQLVariable
Attributes NullableContextAttribute, NullableAttribute
Properties
Name
Gets the variable name (without the $ prefix).
public string Name { get; }
Property Value
GraphQLType
Gets the GraphQL type (e.g., “ID!”, “String”, “Int”).
public string GraphQLType { get; }
Property Value
DefaultValue
Gets the optional default value.
public object? DefaultValue { get; }
Property Value
HasDefaultValue
Gets whether a default value was specified.
public bool HasDefaultValue { get; }
Property Value
Constructors
GraphQLVariable(String, String)
Initializes a new instance of the GraphQLVariable class.
public GraphQLVariable(string name, string graphQLType)
Parameters
name String
The variable name (without the $ prefix).
graphQLType String
The GraphQL type.
Exceptions
ArgumentException
The name is not a valid GraphQL name or the type is not a valid GraphQL type.
GraphQLVariable(String, String, Object)
Initializes a new instance of the GraphQLVariable class with a default value.
public GraphQLVariable(string name, string graphQLType, object? defaultValue)
Parameters
name String
The variable name (without the $ prefix).
graphQLType String
The GraphQL type.
defaultValue Object?
The default value.
Methods
Reference()
Creates a variable reference for use in argument values.
public GraphQLVariableReference Reference()
Returns
GraphQLVariableReference
A GraphQLVariableReference for this variable.