System.Text.RegularExpressions.RegexWriter.MapCapnum C# (CSharp) Method

MapCapnum() private method

When generating code on a regex that uses a sparse set of capture slots, we hash them to a dense set of indices for an array of capture slots. Instead of doing the hash at match time, it's done at compile time, here.
private MapCapnum ( int capnum ) : int
capnum int
return int
        private int MapCapnum(int capnum)
        {
            if (capnum == -1)
                return -1;

            if (_caps != null)
                return (int)_caps[capnum];
            else
                return capnum;
        }