title: Class initialization by Options
body: <p>I have a function for create user token, and I have some parameters the will install according to the type.
  The main class is <code>ClaimsIdentity</code>
  I created a dictonary that will give the details according to the keys. but I can't use ths way for installing <code>ClaimsIdentity</code>
  what elegant, smart way I have? </p>
  
  <pre><code>private string CreateUserToken(UserDTO id, EmailOrPhone emailOrPhone)
  {
      Claim claims;
      var emailOrphone = new Claim("fieldName", DateTime.Now.AddHours(12).ToString("ddMMyyyy"));
      var tokenHandler = new JwtSecurityTokenHandler();
      var key = Encoding.ASCII.GetBytes("MySecret_Nofshonit");
  
      var dic = new Dictionary&lt;EmailOrPhone, Claim&gt;()
                  {
                      {EmailOrPhone.Phone, new Claim("expiredDate", DateTime.Now.AddHours(12).ToString("ddMMyyyy")) },
                      {EmailOrPhone.Phone, new Claim("fieldName", "Phone")  },
                      {EmailOrPhone.Email, new Claim("expiredDate", DateTime.Now.AddHours(48).ToString("ddMMyyyy")) },
                      {EmailOrPhone.Email, new Claim("fieldName", "Email")  },
                  };
  
      var tokenDescriptor = new SecurityTokenDescriptor
      {
          //Expires = DateTime.Now.AddMonths(3),
          Subject = new ClaimsIdentity(new Claim[]
          {
  
                          new Claim("memberId", id.ToString()),
                          new Claim("creationDate", DateTime.Now.ToString("ddMMyyyy")),
                          new Claim("expiredDate", DateTime.Now.AddMonths(3).ToString("ddMMyyyy")),
                          // ....
          }),
          SigningCredentials = new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature)
      };
  
      var token = tokenHandler.CreateToken(tokenDescriptor);
      var tokenString = tokenHandler.WriteToken(token);
      var encryptedTokenString = Cryptor.Encrypt(tokenString);
  
      return encryptedTokenString;
  }
  </code></pre>