# Use extension methods to check BlackboardNotes (or events)

As seen in the RPG demo project (`CreationPortraitImages.c`s & `CreationExtensions.cs`), when a `BlackboardNote` is passed to a `ReceiveChange()` method, we can sipmly call something very easy to read:

```csharp
public override void ReceiveChange(BlackboardNote blackboardNote)
{
     if (blackboardNote.IsNewActorSelected())
          UpdatePortrait();
}
```

In this code, `IsNewActorSelected()` is an extension method for `BlackboardNote` objects. Check `CreationExtensions.cs` to see the code:

<pre class="language-csharp"><code class="lang-csharp">public static bool IsNewActorSelected(this BlackboardNote note)
{
<strong>    return note.topic == gameData.activePlayerTopic &#x26;&#x26;
</strong>        note.subject == gameData.activePlayerSubject;
}
</code></pre>

In the demo project, we know that the `BlackboardNote` which contains the active player information will only be updated (and sent as a notitication) when it changes. So this extension method returns true if the ***to*****pic** and ***subject*** of the `BlackboardNote` match the topic and subject we have hard coded in the `gameData` class.


---

# 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://infinitypbr.gitbook.io/magic-pig-games/game-modules-4/module-documentation/blackboard/tips-and-tricks/use-extension-methods-to-check-blackboardnotes-or-events.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.
