---
title: MessageContainer
summary: API reference for MessageContainer.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-24
library: SAIF.Services
reference_type: package
---

# MessageContainer

Implements `IMessageContainer`, a simple in-memory accumulator of validation/informational messages used by note and image editing operations (e.g. `SAIF.Services.Agencies.Notes.NoteService`, `SAIF.Services.Agencies.Imaging.ImageService`) to collect user-facing feedback across a call without throwing exceptions. It has no injected dependencies.

## Purpose
- Collects error messages raised during a service operation (property name is accepted but discarded, only the message text is stored).
- Collects warning messages.
- Collects informational messages (not currently exposed for reading).

## Context
- Namespace: `SAIF.Services.Agencies`
- Assembly/package: `SAIF.Services` (packaged inside the `SAIF.SAIFCode.Core` NuGet package)

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| MessageContainer() | `public MessageContainer()` | Initializes the internal warning, error, and information message lists as empty. |
| Warnings | `public IEnumerable<string> Warnings { get; }` | The warning messages accumulated so far, in the order they were added. |
| Errors | `public IEnumerable<string> Errors { get; }` | The error messages accumulated so far, in the order they were added. |
| AddError | `public void AddError(string propertyName, string message)` | Appends `message` to the error list; `propertyName` is accepted (for interface compatibility) but not stored or used. |
| AddWarning | `public void AddWarning(string message)` | Appends `message` to the warning list. |
| AddInformation | `public void AddInformation(string message)` | Appends `message` to the internal information-message list. |

## Behavioral notes
- Informational messages added via `AddInformation` are stored but never exposed through a public getter, so callers cannot currently retrieve them from this type*.
- `AddError` silently discards the `propertyName` argument, so field-level error association is not preserved by this implementation*.

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts. Statements
> marked with ** could not be confirmed; treat as unknown until verified.

## Sources
- Services/SAIF.Services/Agencies/MessageContainer.cs
