Click here to Skip to main content
Click here to Skip to main content
Articles » Languages » C# » General » Downloads
 
Add your own
alternative version

LINQ To Google Image and Google Groups

, 8 May 2007
A LINQ Implementation for Google Images/Groups Search
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MChen.Linq.GoogleSearch.Common
{
    public abstract class Result
    {
        public int Rank { get; internal set; }
        public Uri Url { get; internal set; }
        public string Domain { get; internal set; }
        public string Description { get; internal set; }
    }

    internal abstract class QueryInfo
    {
        public List<string> AllWords = new List<string>();
        public List<string> OrWords = new List<string>();
        public List<string> NotWords = new List<string>();

        public string Domain { get; set; }

        #region private methods
        protected string GetDomain()
        {
            if (Domain == null) return "";
            return Domain;
        }

        protected string GetWords(List<string> list)
        {
            StringBuilder sb = new StringBuilder();
            foreach (string s in list)
                sb.AppendFormat("{0} ", s);
            return sb.ToString();
        }
        #endregion

        public abstract string GetUrl(int start);

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("All:         ");
            foreach (string s in AllWords) sb.AppendFormat("{0}, ", s);
            sb.Append("\n");
            sb.Append("Or:          ");
            foreach (string s in OrWords) sb.AppendFormat("{0}, ", s);
            sb.Append("\n");
            sb.Append("Not:         ");
            foreach (string s in NotWords) sb.AppendFormat("{0}, ", s);
            sb.Append("\n");
            sb.AppendFormat("Domian:      {0}\n", Domain);
            return sb.ToString();
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Ming.Chen
Web Developer
United States United States

| Advertise | Privacy | Mobile
Web04 | 2.8.140827.1 | Last Updated 8 May 2007
Article Copyright 2007 by Ming.Chen
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid