# Using the ArgumentReader

The `ArgumentReader` abstracts the argument, and makes it easier to retrieve information from it. The information can be retrieved and interpreted from within our method to create the actual `Person` instance we want to return.\
Because we know the constructor takes a `string` and an `int`, we can expect the provided argument to be constructed in a way that allows us to retrieve those values.

```cs
[Converter]
public static Person PersonTypeConverter(ArgumentReader reader)
{
    string name = reader.Read<string>();
    int age = reader.Read<int>();

    return new Person(name, age);
}
```

Each component of the argument is being read in order. This means that once a component has been read, it can not be read again. It simply functions as a queue. This makes it so you do not have to specify any indices, but it also means you have to store the values in order.\
With the simple method, We can now support parameters of type `Person`. The input string could look like this: `hello (Bob, 52)`, which would result in a new instance of `Person`, with `name` set to Bob, and `age` set to 52.&#x20;

{% hint style="info" %}
**Note**

When utilizing the `Read()` method, the `ArgumentReader` will recursively attempt to convert the given argument into the specified type. If the type is primitive, it already knows how to convert it, as it is supported by default. If a custom type is specified however, it'll convert it using a custom converter method instead.&#x20;
{% endhint %}


---

# 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://docs.pentafloat.com/documentation/converters/using-the-argumentreader.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.
