You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Tomlyn.Model.TomlTable], from the Tomlyn package, is an example of a type that implements IDictionary`2, but not also its non-generic counterpart, IDictionary.
Seemingly, this prevents use of dot notation (property-access syntax via the member-access operator) to access the dictionary's entries.
# Determine the package's local installation location.# If it isn't installed, install it first, in the current user's scope.while (-not ($installDir= (Get-Package-ErrorAction Ignore -ProviderName NuGet Tomlyn).Source)) {
$null=Install-Package-Scope CurrentUser -ErrorAction Stop -ProviderName NuGet Tomlyn
}
# Load the package's assembly into the session.Add-Type-ErrorAction Stop -LiteralPath (Join-Path$installDir'../lib/netstandard2.0/Tomlyn.dll')
# Define a sample TOML string to parse.$tomlStr=@'foo = "bar"'@# Parse the TOML string into an object mod)el (nested dictionaries).$tomlTable= [Tomlyn.Toml]::ToModel($tomlStr)
# Output the global section's 'foo' value,# first via an indexer, then via dot notation.$tomlTable['foo'],$tomlTable.foo|ForEach-Object { "[$_]" }
Prerequisites
Steps to reproduce
Related:
[Tomlyn.Model.TomlTable], from the Tomlyn package, is an example of a type that implementsIDictionary`2, but not also its non-generic counterpart,IDictionary.Seemingly, this prevents use of dot notation (property-access syntax via the member-access operator) to access the dictionary's entries.
Expected behavior
Actual behavior
Error details
No response
Environment data
Visuals
No response