Source/NFX.Erlang/Types/ErlObject.cs
/// <summary>
/// Try to convert .NET native object type to corresponding Erlang term of given type.
/// Throw exception if conversion is not possible
/// </summary>
Try to convert .NET native object type to corresponding Erlang term of given type.
Throw exception if conversion is not possible
Try to convert . NET native object type to corresponding Erlang term of given type . Throw exception if conversion is not possible
public static IErlObject ToErlObject(this object o, ErlTypeOrder etp, bool strict = true)
    {
      if (o == null)
        return ErlAtom.Undefined;
      var t = o.GetType();
      if (t.IsValueType || o is string)
        return coreToErlObject(o, etp, strict);
      if (ts_Refs == null)
        ts_Refs = new HashSet<object>(NFX.ReferenceEqualityComparer<object>.Instance);
      if (ts_Refs.Contains(o))
        throw new ErlException(StringConsts.ERL_CANNOT_CONVERT_TYPES_CYCLE_ERROR,
            o.GetType().FullName, typeof(IErlObject).Name);
      try { return coreToErlObject(o, etp, strict); }
      finally { ts_Refs.Remove(o); }
    }
public static IErlObject ToErlObject ( this object o , ErlTypeOrder etp , bool strict = true ) { if ( o == null ) return ErlAtom . Undefined ; var t = o . GetType ( ) ; if ( t . IsValueType || o is string ) return coreToErlObject ( o , etp , strict ) ; if ( ts_Refs == null ) ts_Refs = new HashSet < object > ( NFX . ReferenceEqualityComparer < object > . Instance ) ; if ( ts_Refs . Contains ( o ) ) throw new ErlException ( StringConsts . ERL_CANNOT_CONVERT_TYPES_CYCLE_ERROR , o . GetType ( ) . FullName , typeof ( IErlObject ) . Name ) ; try { return coreToErlObject ( o , etp , strict ) ; } finally { ts_Refs . Remove ( o ) ; } }
Try to convert .NET native object type to corresponding Erlang term of given type.
Try to convert . NET native object type to corresponding Erlang term of given type .
object
this
etp
ErlTypeOrder
strict
bool