@@ -13,7 +13,6 @@ namespace UnityExplorer
13
13
public static class ToStringUtility
14
14
{
15
15
internal static Dictionary < string , MethodInfo > toStringMethods = new Dictionary < string , MethodInfo > ( ) ;
16
- internal static Dictionary < string , MethodInfo > toStringFormattedMethods = new Dictionary < string , MethodInfo > ( ) ;
17
16
18
17
private const string nullString = "<color=grey>null</color>" ;
19
18
private const string nullUnknown = nullString + " (?)" ;
@@ -132,22 +131,12 @@ private static string ToString(object value)
132
131
133
132
var type = value . GetActualType ( ) ;
134
133
135
- // Find and cache the relevant ToString method for this Type, if haven't already.
134
+ // Find and cache the ToString method for this Type, if haven't already.
136
135
137
136
if ( ! toStringMethods . ContainsKey ( type . AssemblyQualifiedName ) )
138
137
{
139
- try
140
- {
141
- var formatMethod = type . GetMethod ( "ToString" , ArgumentUtility . ParseArgs ) ;
142
- formatMethod . Invoke ( value , new object [ ] { ParseUtility . NUMBER_FORMAT } ) ;
143
- toStringFormattedMethods . Add ( type . AssemblyQualifiedName , formatMethod ) ;
144
- toStringMethods . Add ( type . AssemblyQualifiedName , null ) ;
145
- }
146
- catch
147
- {
148
- var toStringMethod = type . GetMethod ( "ToString" , ArgumentUtility . EmptyTypes ) ;
149
- toStringMethods . Add ( type . AssemblyQualifiedName , toStringMethod ) ;
150
- }
138
+ var toStringMethod = type . GetMethod ( "ToString" , ArgumentUtility . EmptyTypes ) ;
139
+ toStringMethods . Add ( type . AssemblyQualifiedName , toStringMethod ) ;
151
140
}
152
141
153
142
// Invoke the ToString method on the object
@@ -157,10 +146,7 @@ private static string ToString(object value)
157
146
string toString ;
158
147
try
159
148
{
160
- if ( toStringFormattedMethods . TryGetValue ( type . AssemblyQualifiedName , out MethodInfo formatMethod ) )
161
- toString = ( string ) formatMethod . Invoke ( value , new object [ ] { ParseUtility . NUMBER_FORMAT } ) ;
162
- else
163
- toString = ( string ) toStringMethods [ type . AssemblyQualifiedName ] . Invoke ( value , ArgumentUtility . EmptyArgs ) ;
149
+ toString = ( string ) toStringMethods [ type . AssemblyQualifiedName ] . Invoke ( value , ArgumentUtility . EmptyArgs ) ;
164
150
}
165
151
catch ( Exception ex )
166
152
{
0 commit comments