91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 19.38MB
    文件類型: .rar
    金幣: 1
    下載: 0 次
    發布日期: 2023-07-08
  • 語言: C#
  • 標簽: thread??

資源簡介

C#線程參考手冊 pdf 照書上打的代碼。部分可用 C#線程參考手冊 pdf 照書上打的代碼。部分可用 C#線程參考手冊 pdf 照書上打的代碼。部分可用

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections;
using?System.Collections.Generic;
using?System.Linq;
using?System.Text;
using?System.Threading;
using?System.Threading.Tasks;

namespace?BookLib
{
????internal?interface?IBookCollection
????{
????????void?Clear();
????????void?Add(Book?n);
????????Book?GetBook(string?ISBN);
????????bool?IsSynchronized?{?get;?}
????????object?SyncRoot?{?get;?}

????}

????public?class?Book
????{
????????public?string?Name;
????????public?string?ISBN;
????????public?string?Author;
????????public?string?Publisher;
????}

?????class?BookLib?:?IBookCollection
?????{
?????????internal?Hashtable?bk?=?new?Hashtable(10);
?????????public?virtual?void?Clear()
?????????{
?????????????this.bk.Clear();
?????????}

?????????public?virtual?void?Add(Book?n)
?????????{
?????????????Console.WriteLine(“adding?book?for?threadid:?“?+?Thread.CurrentThread.GetHashCode()?+?“?ISBN“?+?n.ISBN);
?????????????Thread.Sleep(2000);
?????????????bk.Add(n.ISBN?n);
?????????}

?????????public?virtual?Book?GetBook(string?ISBN)
?????????{
?????????????Console.WriteLine(“getting?book?for?threadid:?“?+?Thread.CurrentThread.GetHashCode());
?????????????return?(Book)?bk[ISBN];
?????????}

?????????public?virtual?bool?IsSynchronized
?????????{
?????????????get?{?return?(false);?}
?????????}

?????????public?virtual?object?SyncRoot
?????????{
?????????????get?{?return?(this);?}
?????????}

?????????public?BookLib?Synchronized()
?????????{
?????????????return?Synchronized(this);
?????????}
?????????public?static?BookLib?Synchronized(BookLib?bc)
?????????{
?????????????if?(bc?==?null)
?????????????{
?????????????????throw?new?ArgumentNullException(“bc“);
?????????????}
?????????????if?(bc.GetType()?==?typeof?(SyncBookLib))
?????????????{
?????????????????throw?new?InvalidOperationException(“BookLib?reference?is?already?synchronized.“);
?????????????}
?????????????return?new?SyncBookLib(bc);
?????????}
?????????public?static?IBookCollection?Synchronized(IBookCollection?acc)
?????????{
?????????????if?(acc?==?null)
?????????????{
?????????????????throw?new?ArgumentNullException(“acc“);
?????????????}
?????????????if?(acc.GetType()?==?typeof(SyncBookLib))
?????????????{
?????????????????throw?new?InvalidOperationException(“BookLib?reference?is?already?synchronized.“);
?????????????}
?????????????return?new?SyncBookLib(acc);
?????????}
?????}

????internal?sealed?class?SyncBookLib?:?BookLib
????{
????????private?object?syncRoot;
????????private?object?booklib;

????????internal?SyncBookLib(IBookCollection?acc)
????????{
????????????booklib?=?acc;
????????????syncRoot?=?acc.SyncRoot;
????????}

????????public?override?void?Clear()
????????{
????????????lock?(syncRoot)
????????????{
????????????????base.Clear();
????????????}
????????}

????????public?override?void?Add(Book?n)
????????{
????????????lock?(syncRoot)
????????????{
????????????????base.Add(n);
??????

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件????6286308??2016-04-13?14:02??thread\C#線程參考手冊.pdf

?????文件????????187??2016-03-31?15:33??thread\code\BookLib\App.config

?????文件???????8192??2016-03-31?17:14??thread\code\BookLib\bin\Debug\BookLib.exe

?????文件????????187??2016-03-31?15:33??thread\code\BookLib\bin\Debug\BookLib.exe.config

?????文件??????19968??2016-03-31?17:14??thread\code\BookLib\bin\Debug\BookLib.pdb

?????文件??????23168??2016-03-31?17:14??thread\code\BookLib\bin\Debug\BookLib.vshost.exe

?????文件????????187??2016-03-31?15:33??thread\code\BookLib\bin\Debug\BookLib.vshost.exe.config

?????文件????????490??2013-03-18?17:00??thread\code\BookLib\bin\Debug\BookLib.vshost.exe.manifest

?????文件???????2556??2016-03-31?15:33??thread\code\BookLib\BookLib.csproj

?????文件????????247??2016-03-31?17:14??thread\code\BookLib\obj\Debug\BookLib.csproj.FileListAbsolute.txt

?????文件???????8192??2016-03-31?17:14??thread\code\BookLib\obj\Debug\BookLib.exe

?????文件??????19968??2016-03-31?17:14??thread\code\BookLib\obj\Debug\BookLib.pdb

?????文件????????725??2016-04-08?16:40??thread\code\BookLib\obj\Debug\DesignTimeResolveAssemblyReferences.cache

?????文件???????6589??2016-04-13?14:58??thread\code\BookLib\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

?????文件??????????0??2016-03-31?15:33??thread\code\BookLib\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs

?????文件??????????0??2016-03-31?15:33??thread\code\BookLib\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs

?????文件??????????0??2016-03-31?15:33??thread\code\BookLib\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs

?????文件???????4934??2016-03-31?17:14??thread\code\BookLib\Program.cs

?????文件???????1356??2016-03-31?15:33??thread\code\BookLib\Properties\AssemblyInfo.cs

?????文件????????187??2016-04-01?14:25??thread\code\Calculate\App.config

?????文件???????6656??2016-04-05?16:44??thread\code\Calculate\bin\Debug\Calculate.exe

?????文件????????187??2016-04-01?14:25??thread\code\Calculate\bin\Debug\Calculate.exe.config

?????文件??????17920??2016-04-05?16:44??thread\code\Calculate\bin\Debug\Calculate.pdb

?????文件??????23168??2016-04-06?11:20??thread\code\Calculate\bin\Debug\Calculate.vshost.exe

?????文件????????187??2016-04-01?14:25??thread\code\Calculate\bin\Debug\Calculate.vshost.exe.config

?????文件????????490??2013-03-18?17:00??thread\code\Calculate\bin\Debug\Calculate.vshost.exe.manifest

?????文件???????2560??2016-04-01?14:25??thread\code\Calculate\Calculate.csproj

?????文件????????352??2016-04-06?11:20??thread\code\Calculate\obj\Debug\Calculate.csproj.FileListAbsolute.txt

?????文件???????1755??2016-04-05?16:17??thread\code\Calculate\obj\Debug\Calculate.csprojResolveAssemblyReference.cache

?????文件???????6656??2016-04-05?16:44??thread\code\Calculate\obj\Debug\Calculate.exe

............此處省略1291個文件信息

評論

共有 條評論