title: Defining List of Enum as DTO Class C#
body: <p>This is my input JSON response</p>
  
  <pre><code>{
     "permissions": {
              "user": [
                  "Add",
                  "Update",
                  "Delete"
              ],
              "Product": [
                  "Read",
                  "Create"
              ]
          }
  }
  </code></pre>
  
  <p>I'm trying to create the DTO class for the same. So far I've created a set of Enum with the available values </p>
  
  <p><strong>PermissionAction Enum</strong></p>
  
  <pre><code> public enum PermissionAction
      {
          Add,
          Update,
          Read,
          Delete,
          Create
      }
  </code></pre>
  
  <p><strong>PermissionItem Enum</strong></p>
  
  <pre><code>public enum PermissionItem
  {
      User,
      Product
  }
  </code></pre>
  
  <p>How to create a DTO Class for the given JSON Response with the available Enums?</p>
  
  <p>I tired like differently like</p>
  
  <pre><code>public class Permissions
  {
  
      public List&lt;PermissionAction&gt; User { get; set; }
  
      public List&lt;PermissionItem&gt; Product { get; set; }
  }
  </code></pre>
  
  <p>Which is wrong.</p>
  
  <p>Since the response may vary dynamically. What I mean that is sometimes a <code>User</code> List will not available and sometimes <code>Product</code> is not available.</p>
  
  <p>Like,</p>
  
  <pre><code>{
     "permissions": {
              "user": [
                  "Add",
                  "Update",
                  "Delete"
              ]
        }
  }
  </code></pre>
  
  <p>I need to support those kinds of response also with my DTO Class.</p>
  
  <p>UPDATE 1:</p>
  
  <p><em>I think the JSON which I posted above is confusing others. Sorry for that confusion. Actually, my permissions JSON Object is contained List of Permission Item(s) in which each Permission Items itself again having a List of Permission Actions.</em> </p>