Created
June 3, 2014 12:51
-
-
Save EsProgram/446f006b710794fc3762 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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