Exemplo n.º 1
0
        internal static HttpSource BuildHttpSource([NotNull] this V2FeedParser v2FeedParser)
        {
            if (v2FeedParser == null)
            {
                throw new ArgumentNullException(nameof(v2FeedParser));
            }

            var type = v2FeedParser.GetType();

            const string httpSourcePrivateReadonlyFieldName = "_httpSource";
            var          httpSource = type.GetField(httpSourcePrivateReadonlyFieldName, BindingFlags.NonPublic | BindingFlags.Instance);

            if (httpSource == null)
            {
                throw new MissingFieldException(httpSourcePrivateReadonlyFieldName);
            }

            return(httpSource.GetValue(v2FeedParser) as HttpSource);
        }