コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SafeHGlobalHandle"/> class.
 /// </summary>
 /// <param name="s">The secure string.</param>
 public SafeHGlobalHandle(Security.SecureString s) :
     base(IntPtr.Zero, p => { Marshal.ZeroFreeGlobalAllocUnicode(p); return(true); }, true)
 {
     if (s != null)
     {
         s.MakeReadOnly();
         SetHandle(Marshal.SecureStringToGlobalAllocUnicode(s));
         Size = s.Length;
     }
 }
コード例 #2
0
        public void InvalidCombinationOfAccessToken(string description, object[] Params)
        {
            _builder = new SqlConnectionStringBuilder
            {
                ["Data Source"] = "sample.database.windows.net"
            };

            if (Params.Length == 1)
            {
                Security.SecureString password = new Security.SecureString();
                password.MakeReadOnly();
                _credential = new SqlCredential(Params[0] as string, password);
            }
            else
            {
                _builder[Params[0] as string] = Params[1];
            }
            InvalidCombinationCheck(_credential);
        }