Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ TryGet< T >()

static bool Terraria.Social.Base.AWorkshopEntry.TryGet< T > ( Dictionary< string, object > dict,
string name,
out T outputValue )
inlinestaticprotectedinherited

Definition at line 99 of file AWorkshopEntry.cs.

100 {
101 //IL_0034: Unknown result type (might be due to invalid IL or missing references)
102 //IL_003e: Expected O, but got Unknown
103 outputValue = default(T);
104 try
105 {
106 if (dict.TryGetValue(name, out var value))
107 {
108 if (value is T)
109 {
111 return true;
112 }
113 if (value is JObject)
114 {
115 outputValue = JsonConvert.DeserializeObject<T>(((object)(JObject)value).ToString());
116 return true;
117 }
119 return true;
120 }
121 return false;
122 }
123 catch
124 {
125 return false;
126 }
127 }
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
static ? object ChangeType(object? value, TypeCode typeCode)
Definition Convert.cs:229

References System.Convert.ChangeType(), System.T, System.ToString, System.Collections.Generic.Dictionary< TKey, TValue >.TryGetValue(), and System.value.