diff --git a/src/NexusMods.Paths/FileTree/FileTreeNode.cs b/src/NexusMods.Paths/FileTree/FileTreeNode.cs index 9acf4ec..7c7d834 100644 --- a/src/NexusMods.Paths/FileTree/FileTreeNode.cs +++ b/src/NexusMods.Paths/FileTree/FileTreeNode.cs @@ -189,6 +189,18 @@ public static FileTreeNode CreateTree(IEnumerable + /// Deconstructs the node into its path and value. + /// + /// + /// + public void Deconstruct(out TPath path, out TValue? value) + { + path = Path; + value = Value; + } + /// /// Populates the tree with the given collection of file entries. /// diff --git a/tests/NexusMods.Paths.Tests/FileTree/AbsoluteFileTreeTests.cs b/tests/NexusMods.Paths.Tests/FileTree/AbsoluteFileTreeTests.cs index d357147..eee4d62 100644 --- a/tests/NexusMods.Paths.Tests/FileTree/AbsoluteFileTreeTests.cs +++ b/tests/NexusMods.Paths.Tests/FileTree/AbsoluteFileTreeTests.cs @@ -28,8 +28,9 @@ public void Test_FindNode(string path, bool isUnix, bool found, int value) if (found) { node.Should().NotBeNull(); - node!.Path.Should().Be(CreateAbsPath(path, isUnix)); - node!.Value.Should().Be(value); + var (testPath, testValue) = node!; + testPath.Should().Be(CreateAbsPath(path, isUnix)); + testValue.Should().Be(value); } else { diff --git a/tests/NexusMods.Paths.Tests/FileTree/RelativeFileTreeTests.cs b/tests/NexusMods.Paths.Tests/FileTree/RelativeFileTreeTests.cs index 66f3464..683ac42 100644 --- a/tests/NexusMods.Paths.Tests/FileTree/RelativeFileTreeTests.cs +++ b/tests/NexusMods.Paths.Tests/FileTree/RelativeFileTreeTests.cs @@ -19,8 +19,9 @@ public void Test_FindNode(string path, bool found, int value) if (found) { node.Should().NotBeNull(); - node!.Path.Should().Be((RelativePath)path); - node!.Value.Should().Be(value); + var (testPath, testValue) = node!; + testPath.Should().Be((RelativePath)path); + testValue.Should().Be(value); } else {