FastQuant.DataSeries.GetKey C# (CSharp) Method

GetKey() private method

private GetKey ( long index, DataKey key = null ) : DataKey
index long
key DataKey
return DataKey
        internal DataKey GetKey(long index, DataKey key = null)
        {
            lock (Sync)
            {
                if (0 <= index && index < Count)
                {
                    if (key == null)
                        key = this.readKey;
                    DataKey @class = null;
                    if (key != null)
                    {
                        if (key.index1 <= index && index <= key.index2)
                        {
                            return key;
                        }
                        if (index > key.index2)
                        {
                            @class = GetNextKey(key);
                        }
                    }
                    if (@class == null)
                    {
                        @class = GetFirstKey();
                    }
                    while (index < @class.index1 || index > @class.index2)
                    {
                        @class = GetNextKey(@class);
                    }
                    return @class;
                }
                Console.WriteLine($"DataSeries::GetKey Error: index is out of range : {Name} {index}");
                return null;
            }
        }

Same methods

DataSeries::GetKey ( DateTime dateTime, DataKey key = null, IndexOption option = IndexOption.Null ) : DataKey