C# Class Scriban.Runtime.ScriptObjectExtensions

Extensions attached to an IScriptObject.
Datei anzeigen Open project: lunet-io/scriban

Public Methods

Method Description
GetScriptObject ( this @this ) : ScriptObject

Gets the script object attached to the specified instance.

Import ( this @this, IScriptObject other ) : void

Imports the specified ScriptObject into this instance by copying the member values into this object.

Import ( this script, object obj ) : void

Imports the specified object intto this ScriptObject context. See remarks.

  • If obj is a System.Type, this method will import only the static field/properties of the specified object.
  • If obj is a ScriptObject, this method will import the members of the specified object into the new object.
  • If obj is a plain object, this method will import the public fields/properties of the specified object into the ScriptObject.
Import ( this script, object obj, ScriptMemberImportFlags flags, FilterMemberDelegate filter = null, IMemberRenamer renamer = null ) : void

Imports the specified object.

Import ( this script, string member, Delegate function ) : void

Imports the delegate to the specified member.

ImportMember ( this script, object obj, string memberName, string exportName = null ) : void

Imports a specific member from the specified object.

TrySetValue ( this @this, string member, object value, bool readOnly ) : bool

Tries to set the value and readonly state of the specified member.

Method Details

GetScriptObject() public static method

Gets the script object attached to the specified instance.
Expecting ScriptObject or ScriptArray instance
public static GetScriptObject ( this @this ) : ScriptObject
@this this
return ScriptObject

Import() public static method

Imports the specified ScriptObject into this instance by copying the member values into this object.
public static Import ( this @this, IScriptObject other ) : void
@this this
other IScriptObject The other .
return void

Import() public static method

Imports the specified object intto this ScriptObject context. See remarks.
  • If obj is a System.Type, this method will import only the static field/properties of the specified object.
  • If obj is a ScriptObject, this method will import the members of the specified object into the new object.
  • If obj is a plain object, this method will import the public fields/properties of the specified object into the ScriptObject.
public static Import ( this script, object obj ) : void
script this
obj object The object.
return void

Import() public static method

Imports the specified object.
public static Import ( this script, object obj, ScriptMemberImportFlags flags, FilterMemberDelegate filter = null, IMemberRenamer renamer = null ) : void
script this
obj object The object.
flags ScriptMemberImportFlags The import flags.
filter FilterMemberDelegate A filter applied on each member
renamer IMemberRenamer The member renamer.
return void

Import() public static method

Imports the delegate to the specified member.
if member or function are null
public static Import ( this script, string member, Delegate function ) : void
script this
member string The member.
function System.Delegate The function delegate.
return void

ImportMember() public static method

Imports a specific member from the specified object.
public static ImportMember ( this script, object obj, string memberName, string exportName = null ) : void
script this
obj object The object.
memberName string Name of the member.
exportName string Name of the member name replacement. If null, use the default renamer will be used.
return void

TrySetValue() public static method

Tries to set the value and readonly state of the specified member.
public static TrySetValue ( this @this, string member, object value, bool readOnly ) : bool
@this this
member string The member.
value object The value.
readOnly bool if set to true the value will be read only.
return bool