forked from MonoGame/MonoGame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OpaqueDataDictionary.cs
26 lines (24 loc) · 954 Bytes
/
OpaqueDataDictionary.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// MonoGame - Copyright (C) The MonoGame Team
// This file is subject to the terms and conditions defined in
// file 'LICENSE.txt', which is part of this source code package.
using System;
namespace Microsoft.Xna.Framework.Content.Pipeline
{
[ContentSerializerCollectionItemName("Data")]
public sealed class OpaqueDataDictionary : NamedValueDictionary<Object>
{
/// <summary>
/// Get the value for the specified key
/// </summary>
/// <key>The key of the item to retrieve.</key>
/// <defaultValue>The default value to return if the key does not exist.</defaultValue>
/// <returns>The item cast as T, or the default value if the item is not present in the dictonary.</returns>
public T GetValue<T> (string key, T defaultValue)
{
object o;
if (TryGetValue (key, out o))
return (T)o ;
return defaultValue;
}
}
}