Pchp.Library.PerlRegex.Match.Synchronized C# (CSharp) Method

Synchronized() public static method

Returns a Match instance equivalent to the one supplied that is safe to share between multiple threads.
public static Synchronized ( Match inner ) : Match
inner Match
return Match
        public static Match Synchronized(Match inner)
        {
            if (inner == null)
                throw new ArgumentNullException(nameof(inner));

            int numgroups = inner._matchcount.Length;

            // Populate all groups by looking at each one
            for (int i = 0; i < numgroups; i++)
            {
                Group group = inner.Groups[i];

                // Depends on the fact that Group.Synchronized just
                // operates on and returns the same instance
                Group.Synchronized(group);
            }

            return inner;
        }