title: Why is my code not CLS-compliant?
body: <p>I've got errors when I build my project:</p>
  
  <blockquote>
    <p>Warning as Error: Type of 'OthersAddresses.AddresseTypeParameter' is not CLS-compliant    C:...\Units\OthersAddresses.ascx.cs</p>
  </blockquote>
  
  <pre><code>public Address.AddressTypeEnum AddressTypeParameter
      {
          get 
          {
              return _addressTypeParameter;
          }
          set 
          {
              _addressTypeParameter = value;
          }
      }
  </code></pre>
  
  <p>and this one:</p>
  
  <blockquote>
    <p>Warning as Error: Type of 'Global.UserInSession' is not CLS-compliant C:...\Global.asax.cs</p>
  </blockquote>
  
  <pre><code>public static User UserInSession
  {
      get
      {
          return (HttpContext.Current.Session["CurrentUser"] == null) 
              ? null 
              : HttpContext.Current.Session["CurrentUser"] as User;
      }
      set
      {
          HttpContext.Current.Session["CurrentUser"] = value;
      }
  }
  </code></pre>
  
  <hr>
  
  <p>I added attribute <code>[CLSCompliant(false)]</code> before <code>UserInSession</code> and <code>AddresseTypeParameter</code> and it works but I would like to understand why it was not CLS-compliant.</p>
  
  <p>Some more information about classes and enum:</p>
  
  <p><strong>Class User (User.cs)</strong></p>
  
  <pre><code>public class User
      {
          private string _uniqueIdentifier;
          private string _password = string.Empty;
          private string _email = string.Empty;
          private string _passwordQuestion = string.Empty;
          private string _passwordAnswer = string.Empty;
          private string _id_directions_db = string.Empty;
          private string _id_gesab = string.Empty;
          private string _zipCode = string.Empty;
          private string _fonction_id = string.Empty;
          private string _fonction = string.Empty;
          private string _structure_id = string.Empty;
          private string _structure = string.Empty;
          private string _firstName = string.Empty;
          private string _lastName = string.Empty;
          private string _company = string.Empty;
          private string _avatarPath = string.Empty;
          private Role _role = new Role();
          private List&lt;Address&gt; _addressList = new List&lt;Address&gt;();
          private string _otherInformation = string.Empty;
          private MembershipUser _membershipUserAssociated = null;
          ...
  
          public enum GenderEnum
          {
              Empty = 0,
              Monsieur,
              Madame
          }
  </code></pre>
  
  <p>And</p>
  
  <p><strong>enum AddressTypeEnum (Address.cs)</strong></p>
  
  <pre><code>public class Address
  {
      private AddressTypeEnum _addressType;
      private string _firstName = string.Empty;
      private string _lastName =string.Empty;
      private string _structure = string.Empty;
      private string _structureComplementary = string.Empty;
      private string _addressStreet = string.Empty;
      private string _addressComplementary = string.Empty;
      private string _bp = string.Empty;
      private string _zipCode = string.Empty;
      private string _country = string.Empty;
      private string _countryId = string.Empty;
      private string _city = string.Empty;
      private string _phone = string.Empty;
      private string _fax = string.Empty;
      private string _email = string.Empty;
  
      public enum AddressTypeEnum
      {
          Empty = 0,
          Personal = 1,
          Billing = 2,
          Delivery = 3
      }
  </code></pre>