https://github.com/stefh/portable.concurrentdictionary
Portable, Silverlight 5.0 and Windows Phone Silverlight 8.0 & 8.1 implementation of the ConcurrentDictionary
https://github.com/stefh/portable.concurrentdictionary
Last synced: about 1 year ago
JSON representation
Portable, Silverlight 5.0 and Windows Phone Silverlight 8.0 & 8.1 implementation of the ConcurrentDictionary
- Host: GitHub
- URL: https://github.com/stefh/portable.concurrentdictionary
- Owner: StefH
- License: mit
- Created: 2016-04-27T14:07:35.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2023-03-30T17:15:15.000Z (about 3 years ago)
- Last Synced: 2024-04-14T13:08:15.409Z (about 2 years ago)
- Language: C#
- Homepage:
- Size: 60.5 KB
- Stars: 4
- Watchers: 3
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Portable.ConcurrentDictionary
## Info
| | |
| --- | --- |
| **Build AppVeyor** | [](https://ci.appveyor.com/project/StefH/portable-concurrentdictionary) |
| **Portable.ConcurrentDictionary** | [](https://www.nuget.org/packages/Portable.ConcurrentDictionary) |
## Framework support
This is a backport from System.Collections.Concurrent.ConcurrentDictionary defined in .NET Core and this library helps supporting frameworks:
- .NET Standard 1.0
- .NET 2.0
- .NET 3.5
- Silverlight 5.0
- Windows Phone Silverlight 8.0
- Windows Phone Silverlight 8.1
- Windows Phone 8.1
- Windows 8
## ConcurrentDictionary
ConcurrentDictionary is quite usuful dictionary with a thread-safe feature.
### Examples
```csharp
// New instance. (from http://www.dotnetperls.com/concurrentdictionary)
var con = new ConcurrentDictionary();
con.TryAdd("cat", 1);
con.TryAdd("dog", 2);
// Try to update if value is 4 (this fails).
con.TryUpdate("cat", 200, 4);
// Try to update if value is 1 (this works).
con.TryUpdate("cat", 100, 1);
// Write new value.
Console.WriteLine(con["cat"]);
```
This project is based on https://github.com/SaladLab/NetLegacySupport