Description
The Deconstruct
method is a member of the ConnectionHandleConfig
struct within the Editor.NodeEditor
namespace. This method is used to deconstruct a ConnectionHandleConfig
instance into its constituent parts, which are output as separate variables. This is particularly useful for pattern matching and simplifying the extraction of multiple properties from a single object.
Usage
To use the Deconstruct
method, you need to have an instance of ConnectionHandleConfig
. You can then call the method, passing in variables with the out
keyword to receive the values of the properties:
ConnectionHandleConfig config = new ConnectionHandleConfig();
config.Deconstruct(out string name, out DragDirection direction, out ConnectionPlug relativePlug, out Vector2 sceneOrigin, out float defaultValue, out float? min, out float? max);
After calling Deconstruct
, the variables name
, direction
, relativePlug
, sceneOrigin
, defaultValue
, min
, and max
will contain the respective values from the ConnectionHandleConfig
instance.
Example
ConnectionHandleConfig config = new ConnectionHandleConfig();
config.Deconstruct(out string name, out DragDirection direction, out ConnectionPlug relativePlug, out Vector2 sceneOrigin, out float defaultValue, out float? min, out float? max);
// Now you can use the deconstructed values
Console.WriteLine($"Name: {name}, Direction: {direction}, Relative Plug: {relativePlug}, Scene Origin: {sceneOrigin}, Default: {defaultValue}, Min: {min}, Max: {max}");