Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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