Observer ¹Û²ìÕßģʽ £¨HeadFirstÉè¼Æģʽ c#£©
Observer.cs
using System;
using System.Text;
using System.Collections.Generic;
namespace Observer
{
public interface ISubject
{
void RegisterObserver(IOvserver o);
void RemoveObserver(IOvserver o);
void NotifyObserver();
}
public interface IOvserver
{
void update(float temp, float humidity, float pressure);
}
public interface IDisplayElement
{
void display();
}
public class WeatherData:ISubject
{
private List<IOvserver> obList;
private float temperature;
private float humidity;
private float pressure;
public WeatherData()
{
obList = new List<IOvserver>();
}
public void RegisterObserver(IOvserver o)
{
obList.Add(o);
}
public void RemoveObserver(IOvserver o)
{
if (obList.IndexOf(o) >= 0)
{
&nb
Ïà¹ØÎĵµ£º
²Î¿¼¡¶ASP.NETÓëSQLÒ»Æð´ò°ü²¿Êð°²×°¡·
£¬ÕâƪÎÄÕÂÊÇÕë¶ÔVB.NETÓëSQL Ò»Æð´ò°üµÄ,µ«ÊÇÎÒʹÓõÄÊÇC#,µ±È»Ö»ÒªÐÞ¸ÄÒ»ÏÂÖ÷Òª°²×°Àà¿â¾ÍÐÐÁË!C#µÄÀà¿â´úÂëÈçÏÂ:DBCustomAction.cs
using System;
using System.Collections;
using System.Data.SqlClient;
using System.ComponentModel;
using System.Configuration.Inst ......
1 using System;
2 using System.Collections;
3 using System.Configuration;
4 using System.Data;
5 using System.Linq;
6 using System.Web;
7 using System.Web.Security;
8 using&nbs ......
Ò»¡¢Access´ÓExcelÖе¼ÈëÊý¾Ý
1.Óõ½µÄExcel±íµÄ¸ñʽ¼°ÄÚÈÝ
ʵÏÖ
OleDbConnection con = new OleDbConnection();
try
{
OpenFileDialog openFile = new OpenFileDialog();//´ò¿ªÎļþ¶Ô»°¿ò¡£
openFile.Filter = ("Excel Îļþ(*.xls)|*.xls") ......
c#±à³Ì»ù´¡Ö®¶þ£ºÌØÐÔ ÕâÀïµÄÌØÐÔÇø±ðÓÚÊôÐÔ£¬ËäÈ»msdnÖÐËƺõ²¢Ã»ÓÐÇø±ð¶þÕß¡£
ÊôÐÔ£ºÊÇÃæÏò¶ÔÏó±à³ÌµÄ»ù±¾¸ÅÄÌṩÁ˶Ô˽ÓÐ×ֶεķÃÎÊ·â×°£¬ÔÚC#ÖÐÒÔgetºÍset·ÃÎÊÆ÷·½·¨ÊµÏֶԿɶÁ¿ÉдÊôÐԵIJÙ×÷£¬ÌṩÁË°²È«ºÍÁé»îµÄÊý¾Ý·ÃÎÊ·â×°¡£
ÌØÐÔ£º¹«¹²ÓïÑÔÔËÐÐʱÔÊÐíÌí¼ÓÀàËƹؼü×ÖµÄÃèÊöÉùÃ÷£¬½Ð×öattributes, Ëü¶Ô³ÌÐòÖеÄÔ ......
1. ¼òÊö private¡¢ protected¡¢ public¡¢ internal ÐÞÊηûµÄ·ÃÎÊȨÏÞ¡£
´ð . private : ˽ÓгÉÔ±, ÔÚÀàµÄÄÚ²¿²Å¿ÉÒÔ·ÃÎÊ¡£
protected : ±£»¤³ÉÔ±£¬¸ÃÀàÄÚ²¿ºÍ¼Ì³ÐÀàÖпÉÒÔ·ÃÎÊ¡£
public : ¹«¹²³ÉÔ±£¬ÍêÈ«¹«¿ª£¬Ã»ÓзÃÎÊÏÞÖÆ¡£
internal: ÔÚͬһÃüÃû¿Õ¼äÄÚ¿ÉÒÔ·ÃÎÊ¡£
2 .ÁоÙASP.N ......