如果我使用嵌套模块创建清单模块,则在第一个之后的所有嵌套模块中的导出函数不会出现在可用命令列表中,并且不会触发模块自动加载.
当我运行"Get-Module -ListAvailable"时,它们也不会出现.
只有第一个嵌套模块中的导出函数才会出现在命令列表中.
如果我明确导入模块,则所有导出的函数都可用.
在下面的示例中,在显式导入模块之前,Update-LegacyServices不可用.
我可以使它的唯一方法是将我的模块文件重命名为ps1而不是psm1,并将它们包含在ScriptsToProcess中,这似乎是一个坏主意.
模块清单(psd1)
@{
# Script module or binary module file associated with this manifest.
# RootModule = ''
# Version number of this module.
ModuleVersion = '1.0.0.1'
# ID used to uniquely identify this module
GUID = 'c11d6aca-d531-4d06-a732-5fb95113357f'
# Author of this module
Author = 'luke'
# Company or vendor of this module
CompanyName = ''
# Copyright statement for this module
Copyright = ''
# Description of the functionality provided by this module …Run Code Online (Sandbox Code Playgroud) 调用在实现者的接口上工作的扩展方法似乎需要使用this关键字.这看起来很奇怪.
有谁知道为什么?
有没有更简单的方法来获得接口的共享实现?
当我遭受多重继承/混合撤销时,这让我感到烦恼.
玩具示例:
public interface ITest
{
List<string> TestList { get; }
}
public static class TestExtensions
{
private const string Old = "Old";
private const string New = "New";
public static void ManipulateTestList(this ITest test)
{
for (int i = 0; i < test.TestList.Count; i++)
{
test.TestList[i] = test.TestList[i].Replace(Old, New);
}
}
}
public class Tester : ITest
{
private List<string> testList = new List<string>();
public List<string> TestList
{
get { return testList; }
}
public Tester() …Run Code Online (Sandbox Code Playgroud)