Skip to content

Instantly share code, notes, and snippets.

@EsProgram
Created June 3, 2014 12:51
Show Gist options
  • Save EsProgram/446f006b710794fc3762 to your computer and use it in GitHub Desktop.
Save EsProgram/446f006b710794fc3762 to your computer and use it in GitHub Desktop.
using System;
using System.Text;
using System.Web;
using System.Diagnostics;
namespace CSharpConsole
{
class ブラウザ開いてYahoo検索する
{
[STAThread]
static void Main(string[] args)
{
SearchData sData = new SearchData(@"http://search.yahoo.co.jp/search?fr=yssn&ei=utf-8",
"Yahoo",
"p");
String keyword = "検索検索ぅ♪";
Process.Start(sData.GetSearchUrl(keyword));
}
}
class SearchData
{
readonly String url, title, query;
public SearchData(String url, String siteTitle, String queryParameter)
{
this.url = url;
this.title = siteTitle;
this.query = queryParameter;
}
public String GetSearchUrl(String keyword)
{
return String.Format("{0}&{1}={2}",
url,
query,
HttpUtility.UrlEncode(keyword, Encoding.UTF8));
}
public override String ToString()
{
return title;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment