Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(449)

Side by Side Diff: experimental/visual_studio_plugin/src/NaClVsx.Package/DebugSupport/DWARF/ExtensionMethods.cs

Issue 10928195: First round of dead file removal (Closed) Base URL: https://github.com/samclegg/nativeclient-sdk.git@master
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Native Client Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #region
6
7 using System.Collections.Generic;
8
9 #endregion
10
11 namespace Google.NaClVsx.DebugSupport.DWARF {
12 public static class ExtensionMethods {
13 public static T PeekOrDefault<T>(this Stack<T> s) where T : class {
14 if (s.Count == 0) {
15 return null;
16 }
17 return s.Peek();
18 }
19
20 public static T PeekOrDefault<T>(this Stack<T> s, T defaultValue) {
21 if (s.Count == 0) {
22 return defaultValue;
23 }
24 return s.Peek();
25 }
26
27 public static TV GetValueOrDefault<TK, TV>(this IDictionary<TK, TV> d,
28 TK key,
29 TV defaultValue) {
30 TV result;
31 if (!d.TryGetValue(key, out result)) {
32 result = defaultValue;
33 }
34 return result;
35 }
36 }
37 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698