C#½âÎöHTML
ÔÚËÑË÷ÒýÇæµÄ¿ª·¢ÖУ¬ÎÒÃÇÐèÒª¶ÔÍøÒ³µÄHtmlÄÚÈݽøÐмìË÷£¬ÄÑÃâµÄ¾ÍÐèÒª¶ÔHtml½øÐнâÎö¡£²ð·Öÿһ¸ö½Úµã²¢ÇÒ»ñÈ¡½Úµã¼äµÄÄÚÈÝ¡£´ËÎĽéÉÜÁ½ÖÖC#½âÎöHtmlµÄ·½·¨¡£
µÚÒ»ÖÖ·½·¨£º
ÓÃSystem.Net.WebClientÏÂÔØWeb Page´æµ½±¾µØÎļþ»òÕßStringÖУ¬ÓÃÕýÔò±í´ïʽÀ´·ÖÎö¡£Õâ¸ö·½·¨¿ÉÒÔÓÃÔÚWeb CrawlerµÈÐèÒª·ÖÎöºÜ¶àWeb PageµÄÓ¦ÓÃÖС£
¹À¼ÆÕâÒ²ÊÇ´ó¼Ò×îÖ±½Ó£¬×îÈÝÒ×Ïëµ½µÄÒ»¸ö·½·¨¡£
ת×ÔÍøÉϵÄÒ»¸öʵÀý£ºËùÓеÄhref¶¼³éÈ¡³öÀ´£º
Code
using System;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
namespace HttpGet
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
System.Net.WebClient client = new WebClient();
byte[] page = client.DownloadData("http://www.google.com");
string content = System.Text.Encoding.UTF8.GetString(page);
string regex = "href=[\\\"\\\'](http:\\/\\/|\\.\\/|\\/)?\\w+(\\.\\w+)*(\\/\\w+(\\.\\w+)?)*(\\/|\\?\\w*=\\w*(&\\w*=\\w*)*)?[\\\"\\\']";
Regex re = new Regex(regex);
MatchCollection matches = re.Matches(content);
System.Collections.IEnumerator enu = matches.GetEnumerator();
while&nbs
Ïà¹ØÎĵµ£º
¶¯Ì¬¼ÓÔØDLLÐèҪʹÓÃWindows APIº¯Êý£ºLoadLibrary¡¢GetProcAddressÒÔ¼°FreeLibrary¡£ÎÒÃÇ¿ÉÒÔʹÓÃDllImportÔÚC#ÖÐʹÓÃÕâÈý¸öº¯Êý¡£
[DllImport("Kernel32")]
public static extern int GetProcAddress(int handle, String funcname);
[DllImport("Kernel32")]
public static extern int L ......
C#¿ª·¢WPF/Silverlight¶¯»¼°ÓÎϷϵÁн̳Ì(Game Tutorial)£ºÄ¿Â¼
±¾ÏµÁн̵̳ÄʾÀý´úÂëÏÂÔØ(¸Ðл Òø¹âÖйú Ìṩ×ÊÔ´·ÖÁ÷)£º
µÚÒ»²¿·ÖÔ´Â룺WPFGameTutorial_PartI(1-20½Ú)
µÚ¶þ²¿·ÖÔ´Â룺WPFGameTutorial_PartII(21-26½Ú)
µÚÈý²¿·ÖÔ´Â룺WPFGameTutorial_PartIII(27-30½Ú)
µÚËIJ¿·ÖÔ´Â룺WPFGameTutorial_PartI ......
Welcome to Microsoft Developer Support, Languages team blog! You will find a lot of language related troubleshooting resources here.
Troubleshooting PInvoke Related Issues
I am back with some more PInvoke Stuff. Recently I was working on a PInvoke issue which I found interesting ......
1. ÔÚoracle Ï´´½¨±í
t_user(
ID varchar(20),
Name varchar(20)
)
2. Ìí¼ÓÊý¾Ý
&nb ......
£¨±¸×¢£ºÎÄÖкìÉ«×ÖÌåÊÇÎÒÔÚÔÎĵĻù´¡ÉÏÌí¼ÓµÄ½âÊÍ˵Ã÷£©
΢ÈíµÄʵÀý½Ì²ÄÖн²ÁËÈýÖÖÓïÑÔ£ºc#¡¢vb ¡¢Jscript£¬ÎªÁËÈôó¼Ò¹ýÒ»°Ñж«Î÷ñ«£¬ÎÒÃÇ»¹ÊÇѧc#°É¡£Õâ¸ö×îºÃÓÐÒ»µãc++»ù´¡¡£
²»¹ýûÓÐҲûÓйØÏµ£¬´ó²»Á˶à·ÑµãÁ¦ÁË¡£
ÈκÎÒ»ÃÅÓ ......