C# 作ったプログラムをメソッドでまとめよう。(失敗)
return と 引数の処理がうまくいかない。
単純にメソッドを設定。
→Mainで呼び出しをかけているだけなのだが、
型変換ができない。とおこられる。
また、
戻り値を設定しようとしてもうまくいかない。
困った。ー
考えられるのは、戻り値の型
rerutn の設定。
型変換なら ToString とかだろうか?
それでも自分で理解できる範囲は増えてはきてるので、成長は成長だろう
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Text.RegularExpressions;
namespace ConsoleApplication1
{
class Program
{
static void Main(string args)
{
Test Web = new Test();
Console.WriteLine(Web.Title());
}
}
class Test
{
public string Title()
{
WebClient client = new WebClient();
byte data = client.DownloadData("http://www.socym.co.jp/support/s-967#ttlWrong");
string content = Encoding.GetEncoding("shift-jis").GetString(data);
MatchCollection mc = Regex.Matches(content, "<title>(.*)</title>");
foreach (Match match in mc)
{
Console.WriteLine(" MatchCollectionでのマッチ箇所 {0}", match.Value.ToString());
}
}
}
}