This file contains 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
<unity> | |
<namespace name="Service.Class" /> | |
<assembly name="Service" /> | |
<container> | |
<register type="IOwnExpenseDService" mapTo="OwnExpenseDService" /> | |
<register type="Model.Dal.IOwnExpenseDDal, Model" mapTo="Model.Dal.OwnExpenseDDal, Model" /> | |
</container> | |
</unity> |
This file contains 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
interface IMessageService | |
{ | |
void Send(User user, string msg); | |
} | |
class EmailService : IMessageService | |
{ | |
public void Send(User user, string msg) | |
{ | |
// 寄送電子郵件給指定的 user (略) |
This file contains 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
public interface INotificationManager | |
{ | |
void Notify(string to, string msg); | |
} | |
public class NotificationManager : INotificationManager | |
{ | |
private readonly IMessageService _msgService = null; | |
// 從建構函式注入訊息服務物件。 |
This file contains 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
public interface IMessageService | |
{ | |
void SendMessage(string to, string msg); | |
} | |
public class EmailService : IMessageService | |
{ | |
public void SendMessage(string to, string msg) | |
{ | |
Console.WriteLine(" 透過 EmailService 發送郵件給 {0}。", to); |
This file contains 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.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Runtime.CompilerServices; | |
namespace ConsoleApplication1 | |
{ | |
class Program |
This file contains 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.Collections.Generic; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace Ex01_Console | |
{ | |
class ThreadDemo | |
{ | |
public static void Download(string[] urls) |
This file contains 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.Threading; | |
class Program | |
{ | |
static void Main(strin g[] args) | |
{ | |
Thread t1 = new Thread(MyBackgroundTask); | |
t1.Start(); |
This file contains 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.Threading; | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Thread t1 = new Thread(MyBackgroundTask); | |
Thread t2 = new Thread(MyBackgroundTask); | |
Thread t3 = new Thread(MyBackgroundTask); |
This file contains 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
static void Main(string[] args) | |
{ | |
Thread t1 = new Thread(MyBackgroundTask); | |
Thread t2 = new Thread(MyBackgroundTask); | |
Thread t3 = new Thread(MyBackgroundTask); | |
t1.Start("X"); | |
t2.Start("Y"); | |
t3.Start("Z"); |
This file contains 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
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
new SharedStateDemo().Run(); | |
Console.ReadLine(); | |
} | |
} |
OlderNewer