Last change
on this file since 17282 was
16995,
checked in by gkronber, 6 years ago
|
#2520 Update plugin dependencies and references for HL.FLA for new persistence
|
File size:
797 bytes
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 |
|
---|
4 | namespace HeuristicLab.Analysis.FitnessLandscape {
|
---|
5 | public static class DictionaryExtensions {
|
---|
6 | public static TValue GetValueOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> d, TKey key, Func<TValue> provider) {
|
---|
7 | var value = provider();
|
---|
8 | d.TryGetValue(key, out value);
|
---|
9 | return value;
|
---|
10 | }
|
---|
11 | public static TValue GetValueOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> d, TKey key, TValue def) {
|
---|
12 | var value = def;
|
---|
13 | d.TryGetValue(key, out value);
|
---|
14 | return value;
|
---|
15 | }
|
---|
16 | public static TValue GetValueOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> d, TKey key) {
|
---|
17 | var value = default(TValue);
|
---|
18 | d.TryGetValue(key, out value);
|
---|
19 | return value;
|
---|
20 | }
|
---|
21 | }
|
---|
22 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.