StorytellerDocGen.Topics.Topic.FindPrevious C# (CSharp) Method

FindPrevious() public method

public FindPrevious ( ) : Topic
return Topic
        public Topic FindPrevious()
        {
            if (PreviousSibling != null) return PreviousSibling;

            return Parent;
        }

Usage Example

コード例 #1
0
        private Topic findOther(Topic current, string key)
        {
            if (key.EqualsIgnoreCase("{next}"))
            {
                return current.FindNext();
            }

            if (key.EqualsIgnoreCase("{previous}"))
            {
                return current.FindPrevious();
            }

            var corrected = ToAbsoluteKey(current.Key, key);

            var topic = _top.FindByKey(corrected);
            if (topic == null)
            {
                throw new ArgumentOutOfRangeException(nameof(key), $"Cannot find a topic with key '{corrected}'");
            }

            return topic;
        }