/// <summary> /// Parse the user agent and fills all fields with extracted values. /// </summary> /// <param name="userAgent">The user agent to be parsed.</param> /// <returns>The parsed user agent.</returns> public override UserAgent Parse(UserAgent userAgent) { lock (this) { if (userAgent is null) { return(null); } userAgent.Reset(); if (this.parseCache is null) { return(base.Parse(userAgent)); } var userAgentString = userAgent.UserAgentString; if (userAgentString != null) { if (this.parseCache.ContainsKey(userAgentString)) { userAgent.Clone(this.parseCache[userAgentString]); } else { this.parseCache[userAgentString] = new UserAgent(base.Parse(userAgent)); } } // We have our answer. return(userAgent); } }