# GrapeCity.ActiveReports.PageReportModel.Validation.ValidationUtils.ValidateEnum

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_ActiveReports_PageReportModel_Validation_ValidationUtils_ValidateEnum_" data-uid="GrapeCity.ActiveReports.PageReportModel.Validation.ValidationUtils.ValidateEnum*">ValidateEnum Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_ActiveReports_PageReportModel_Validation_ValidationUtils_ValidateEnum_" data-uid="GrapeCity.ActiveReports.PageReportModel.Validation.ValidationUtils.ValidateEnum*"></a>
<h4 id="GrapeCity_ActiveReports_PageReportModel_Validation_ValidationUtils_ValidateEnum_System_Object_System_Type_" data-uid="GrapeCity.ActiveReports.PageReportModel.Validation.ValidationUtils.ValidateEnum(System.Object,System.Type)">ValidateEnum(object, Type)</h4>
<div class="markdown level1 summary"><p>Validates an enum value against the specified type.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static void ValidateEnum(object value, Type type)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></td>
      <td><span class="parametername">value</span></td>
      <td><p>An <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.enum">Enum</a> value to validate.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.type">Type</a></td>
      <td><span class="parametername">type</span></td>
      <td><p>A <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.type">Type</a> to validate the value against.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="GrapeCity_ActiveReports_PageReportModel_Validation_ValidationUtils_ValidateEnum_System_Object_System_Type__examples">Examples</h5>
<pre><code class="lang-csharp">BorderDrawingStyle value = BorderDrawingStyle.Solid;
ValidationUtils.ValidateEnum(value, typeof(BorderDrawingStyle));</code></pre>

<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Condition</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.componentmodel.invalidenumargumentexception">InvalidEnumArgumentException</a></td>
      <td><p>Throws if the value is not against the specified type.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_ActiveReports_PageReportModel_Validation_ValidationUtils_ValidateEnum_" data-uid="GrapeCity.ActiveReports.PageReportModel.Validation.ValidationUtils.ValidateEnum*"></a>
<h4 id="GrapeCity_ActiveReports_PageReportModel_Validation_ValidationUtils_ValidateEnum_GrapeCity_Enterprise_Data_Expressions_ExpressionInfo_System_Type_" data-uid="GrapeCity.ActiveReports.PageReportModel.Validation.ValidationUtils.ValidateEnum(GrapeCity.Enterprise.Data.Expressions.ExpressionInfo,System.Type)">ValidateEnum(ExpressionInfo, Type)</h4>
<div class="markdown level1 summary"><p>Validates an expression value to make sure it is valid enum value and against the specified type.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static void ValidateEnum(ExpressionInfo expression, Type type)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="../MESCIUS.ActiveReports.Core.Data.ExpressionInfo/GrapeCity.Enterprise.Data.Expressions.ExpressionInfo.html">ExpressionInfo</a></td>
      <td><span class="parametername">expression</span></td>
      <td><p>An <a class="xref" href="../MESCIUS.ActiveReports.Core.Data.ExpressionInfo/GrapeCity.Enterprise.Data.Expressions.ExpressionInfo.html">ExpressionInfo</a> value to validate.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.type">Type</a></td>
      <td><span class="parametername">type</span></td>
      <td><p>A <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.type">Type</a> to validate the value against.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="GrapeCity_ActiveReports_PageReportModel_Validation_ValidationUtils_ValidateEnum_GrapeCity_Enterprise_Data_Expressions_ExpressionInfo_System_Type__examples">Examples</h5>
<pre><code class="lang-csharp">ExpressionInfo value = ExpressionInfo.FromString("Solid");
ValidationUtils.ValidateEnum(value, typeof(BorderDrawingStyle));</code></pre>

<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Condition</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.componentmodel.invalidenumargumentexception">InvalidEnumArgumentException</a></td>
      <td><p>Throws if the value is not against the specified type.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_ActiveReports_PageReportModel_Validation_ValidationUtils_ValidateEnum_" data-uid="GrapeCity.ActiveReports.PageReportModel.Validation.ValidationUtils.ValidateEnum*"></a>
<h4 id="GrapeCity_ActiveReports_PageReportModel_Validation_ValidationUtils_ValidateEnum_GrapeCity_Enterprise_Data_Expressions_ExpressionInfo_System_Type_System_Collections_Generic_IList_System_String__" data-uid="GrapeCity.ActiveReports.PageReportModel.Validation.ValidationUtils.ValidateEnum(GrapeCity.Enterprise.Data.Expressions.ExpressionInfo,System.Type,System.Collections.Generic.IList{System.String})">ValidateEnum(ExpressionInfo, Type, IList&lt;string&gt;)</h4>
<div class="markdown level1 summary"><p>Validates an expression value to make sure it is valid enum value and against the specified type.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static void ValidateEnum(ExpressionInfo expression, Type type, IList&lt;string&gt; additionalValues)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="../MESCIUS.ActiveReports.Core.Data.ExpressionInfo/GrapeCity.Enterprise.Data.Expressions.ExpressionInfo.html">ExpressionInfo</a></td>
      <td><span class="parametername">expression</span></td>
      <td><p>An <a class="xref" href="../MESCIUS.ActiveReports.Core.Data.ExpressionInfo/GrapeCity.Enterprise.Data.Expressions.ExpressionInfo.html">ExpressionInfo</a> value to validate.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.type">Type</a></td>
      <td><span class="parametername">type</span></td>
      <td><p>A <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.type">Type</a> to validate the value against.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1">IList</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a>&gt;</td>
      <td><span class="parametername">additionalValues</span></td>
      <td><p>The additional allowed values.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="GrapeCity_ActiveReports_PageReportModel_Validation_ValidationUtils_ValidateEnum_GrapeCity_Enterprise_Data_Expressions_ExpressionInfo_System_Type_System_Collections_Generic_IList_System_String___examples">Examples</h5>
<pre><code class="lang-csharp">ExpressionInfo value = ExpressionInfo.FromString("Solid");
ValidationUtils.ValidateEnum(value, typeof(BorderDrawingStyle), new[] { "Transparent"});</code></pre>

<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Condition</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.componentmodel.invalidenumargumentexception">InvalidEnumArgumentException</a></td>
      <td><p>Throws if the value is not against the specified type.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
