<p>We have a PageRoles xml file which contains the page path and the user role that can access that page.</p>

<p>We are maintaining a Dictionary in a static class, which gets loaded int static constructor for the class.
The class has a method CheckIfRoleAllowed that takes in a page path and returns a bool.</p>

<p>Each page call the CheckIfRoleAllowed on Page Init.</p>

<pre><code>static class PageAccessChecker
{
 static Dictionary&lt;string, UserRoleType[]&gt; _PageAccessPermissions;
 static FileSystemWatcher _XmlWatcher;

 static PageAccessChecker()
 {
   // Load page access permissions from xml
   // Set FileSystemWatcher watcher to watch for changes
 }

 public static CheckIfRoleAllowed(string pagePath)
 {
 }

}
</code></pre>

<p>Would we be better off doing this using the singleton pattern?
If yes, why?</p>

<p>Kind regards.</p>

You do use a singleton. Simply, there are 2 usual implementations for singletons, the other being instantiating the class and having a static member referencing this instance.
Your implementation makes calls simpler IMO :
```
```
PageAccessChecker.CheckIfRoleAllowed(path);
```
```
instead of:
```
```
PageAccessChecker._default.CheckIfRoleAllowed(path);
```
```