# NotificationService Class

Class NotificationService. Contains various methods with options to open notifications. Should be added as scoped service in the application services and RadzenNotification should be added in application main layout.

Namespace: [Radzen](https://blazor.radzen.com/docs/api/Radzen.md)

Assembly: Radzen.Blazor.dll

## Inheritance

- Object
- NotificationService

## Syntax

```csharp
public class NotificationService
```

## Examples

```razor
@inject NotificationService NotificationService
<RadzenButton Text="Show info notification" Click=@(args => NotificationService.Notify(new NotificationMessage { Severity = NotificationSeverity.Info, Summary = "Info Summary", Detail = "Info Detail", Duration = 4000 })) / >
```

## Constructors

| Constructor | Description |
|-------------|-------------|
| `public NotificationService()` | Class NotificationService. Contains various methods with options to open notifications. Should be added as scoped service in the application services and RadzenNotification should be added in application main layout. |

## Properties

| Property | Type | Description |
|------|------|-------------|
| Messages | `ObservableCollection<NotificationMessage>` | Gets the messages. |

## Methods

| Method | Returns | Description |
|------|---------|-------------|
| `Notify(NotificationMessage message)` | `void` | Notifies the specified message. Parameters: `message`: The message. |
| `Notify(NotificationSeverity severity, string summary, string detail, TimeSpan duration, Action<NotificationMessage> click)` | `void` | Notifies the specified message. |
| `Notify(NotificationSeverity severity, string summary, string detail, double duration, Action<NotificationMessage> click, bool closeOnClick, object payload, Action<NotificationMessage> close)` | `void` | Notifies the specified message. |

