# Attribut

Attribut används för att säga saker *om* klassvariabler, properties och metoder. Med andra ord är de ett slags *metadata* – information om information.

De används en hel del när man konstruerar controllers till REST-servrar, och när man jobbar med JSON-serialisering.

Man skriver attribut mellan hakparenteser `[]` innan det attributet ska gälla.

{% code title="Pokemon.cs" lineNumbers="true" %}

```csharp
using System.Text.Json.Serialization;

public class Pokemon
{
  public string Name {get; set;}
  public bool IsDefault {get; set;}
  
  [JsonIgnore]
  public int CurrentHp {get; set;}
}
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://csharp.progdocs.se/klasser-och-objektorientering/attribut.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
