MCPcopy Create free account
hub / github.com/Squirrel/Squirrel.Windows / TryConvert

Function TryConvert

src/Squirrel/SimpleJson/SimpleJson.cs:357–375  ·  view source on GitHub ↗

Provides implementation for type conversion operations. Classes derived from the class can override this method to specify dynamic behavior for operations that convert an object from one type to another. Provides information about the conversion operation. The binder.Type property provides the type to which the

(ConvertBinder binder, out object result)

Source from the content-addressed store, hash-verified

355 /// Alwasy returns true.
356 /// </returns>
357 public override bool TryConvert(ConvertBinder binder, out object result)
358 {
359 // <pex>
360 if (binder == null)
361 throw new ArgumentNullException("binder");
362 // </pex>
363 Type targetType = binder.Type;
364
365 if ((targetType == typeof(IEnumerable)) ||
366 (targetType == typeof(IEnumerable<KeyValuePair<string, object>>)) ||
367 (targetType == typeof(IDictionary<string, object>)) ||
368 (targetType == typeof(IDictionary)))
369 {
370 result = this;
371 return true;
372 }
373
374 return base.TryConvert(binder, out result);
375 }
376
377 /// <summary>
378 /// Provides the implementation for operations that delete an object member. This method is not intended for use in C# or Visual Basic.

Callers

nothing calls this directly

Calls 1

TryConvertMethod · 0.80

Tested by

no test coverage detected