System.Collections.Generic.HashSet.Contains(ValueSecret)

Here are the examples of the csharp api System.Collections.Generic.HashSet.Contains(ValueSecret) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

19 Source : SecretMasker.cs
with MIT License
from actions

public void AddValue(String value)
        {
            // Test for empty.
            if (String.IsNullOrEmpty(value))
            {
                return;
            }

            var valueSecrets = new List<ValueSecret>(new[] { new ValueSecret(value) });

            // Read section.
            ValueEncoder[] valueEncoders;
            try
            {
                m_lock.EnterReadLock();

                // Test whether already added.
                if (m_originalValueSecrets.Contains(valueSecrets[0]))
                {
                    return;
                }

                // Read the value encoders.
                valueEncoders = m_valueEncoders.ToArray();
            }
            finally
            {
                if (m_lock.IsReadLockHeld)
                {
                    m_lock.ExitReadLock();
                }
            }

            // Compute the encoded values.
            foreach (ValueEncoder valueEncoder in valueEncoders)
            {
                String encodedValue = valueEncoder(value);
                if (!String.IsNullOrEmpty(encodedValue))
                {
                    valueSecrets.Add(new ValueSecret(encodedValue));
                }
            }

            // Write section.
            try
            {
                m_lock.EnterWriteLock();

                // Add the values.
                m_originalValueSecrets.Add(valueSecrets[0]);
                foreach (ValueSecret valueSecret in valueSecrets)
                {
                    m_valueSecrets.Add(valueSecret);
                }
            }
            finally
            {
                if (m_lock.IsWriteLockHeld)
                {
                    m_lock.ExitWriteLock();
                }
            }
        }