Table of Contents

Class ConVar<T>

Namespace
CounterStrikeSharp.API.Modules.Cvars
Assembly
CounterStrikeSharp.API.dll
public class ConVar<T> : ConVarBase, IEquatable<ConVarBase>, IEquatable<ConVar<T>>

Type Parameters

T
Inheritance
object
ConVar<T>
Implements
Inherited Members

Constructors

ConVar(ConVarCreationOptions<T>)

public ConVar(ConVarCreationOptions<T> options)

Parameters

options ConVarCreationOptions<T>

ConVar(string, string, T, ConVarFlags)

public ConVar(string name, string description, T defaultValue, ConVarFlags flags = ConVarFlags.FCVAR_NONE)

Parameters

name string
description string
defaultValue T
flags ConVarFlags

ConVar(ushort)

public ConVar(ushort accessIndex)

Parameters

accessIndex ushort

Properties

MaxValue

Gets or updates the existing upper bound for a numeric, vector, or angle ConVar.

public T MaxValue { get; set; }

Property Value

T

Remarks

Throws if no upper bound exists or the new maximum is below the minimum. Changes apply to subsequent value assignments; the current value is not reclamped. For native objects, assign a new value rather than modifying the returned object's components.

MinValue

Gets or updates the existing lower bound for a numeric, vector, or angle ConVar.

public T MinValue { get; set; }

Property Value

T

Remarks

Throws if no lower bound exists or the new minimum exceeds the maximum. Changes apply to subsequent value assignments; the current value is not reclamped. For native objects, assign a new value rather than modifying the returned object's components.

Value

public T Value { get; set; }

Property Value

T

Methods

Equals(ConVar<T>?)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(ConVar<T>? other)

Parameters

other ConVar<T>

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Find(string)

public static ConVar<T>? Find(string name)

Parameters

name string

Returns

ConVar<T>

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

TryGetMaxValue(out T)

Tries to read the upper bound, returning false and default(T) when it is not set.

public bool TryGetMaxValue(out T value)

Parameters

value T

Returns

bool

Remarks

Invalid ConVars and mismatched value types still throw.

TryGetMinValue(out T)

Tries to read the lower bound, returning false and default(T) when it is not set.

public bool TryGetMinValue(out T value)

Parameters

value T

Returns

bool

Remarks

Invalid ConVars and mismatched value types still throw.