{% seo %}
MY TESTED ASP.NET CORE MVC DOCS
Show / Hide Table of Contents

Class ObjectExtensions

Provides extension methods to all objects.

Inheritance
System.Object
ObjectExtensions
Namespace:MyTested.AspNetCore.Mvc.Utilities.Extensions
Assembly:MyTested.AspNetCore.Mvc.Abstractions.dll
Syntax
public static class ObjectExtensions

Methods

| Improve this Doc View Source

AsDynamic(Object)

Returns the provided object casted as dynamic type.

Declaration
public static dynamic AsDynamic(this object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
System.Object

Object of dynamic type.

| Improve this Doc View Source

GetErrorMessageName(Object, Boolean, String)

Calls ToString on the provided object and returns the value. If the object is null, the provided optional name is returned.

Declaration
public static string GetErrorMessageName(this object obj, bool includeQuotes = true, string nullCaseName = "null")
Parameters
Type Name Description
System.Object obj

Object to get error message name.

System.Boolean includeQuotes

Whether to include quotes around the error message name.

System.String nullCaseName

Name to return in case of null object.

Returns
Type Description
System.String

Error message name.

| Improve this Doc View Source

GetName(Object)

Gets friendly type name of object. Useful for generic types.

Declaration
public static string GetName(this object obj)
Parameters
Type Name Description
System.Object obj

Object to get friendly name from.

Returns
Type Description
System.String

Friendly name as string.

| Improve this Doc View Source

ToObjectValueDictionary(Object)

Declaration
public static IDictionary<string, object> ToObjectValueDictionary(this object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
System.Collections.Generic.IDictionary<System.String, System.Object>
| Improve this Doc View Source

ToStringValueDictionary(Object)

Declaration
public static IDictionary<string, string> ToStringValueDictionary(this object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
System.Collections.Generic.IDictionary<System.String, System.String>
| Improve this Doc View Source

TryCastTo<T>(Object)

Declaration
public static T TryCastTo<T>(this object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
T
Type Parameters
Name Description
T
  • Improve this Doc
  • View Source
In This Article
  • Methods
    • AsDynamic(Object)
    • GetErrorMessageName(Object, Boolean, String)
    • GetName(Object)
    • ToObjectValueDictionary(Object)
    • ToStringValueDictionary(Object)
    • TryCastTo<T>(Object)
Back to top Copyright © 2015-2016 MyTestedASP.NET. All Rights Reserved. Generated by DocFX