在 BC 19 中删除 DotNet
我想摆脱 DotNet。
是否有任何代码单元可以用于此代码(也许是文件管理中的某些内容):
procedure GetNoOfFilesInFolder(): Integer
var
DirectoryInfo: DotNet DirectoryInfo;
Directory: DotNet Directory;
begin
IF NOT Directory.Exists(pathToFolder) THEN
EXIT(-1);
DirectoryInfo := DirectoryInfo.DirectoryInfo(pathToFolder);
EXIT(DirectoryInfo.GetFiles().Length);
end;
I want to get rid of the DotNet.
Are there any Codeunits I can use for this code (Maybe something in the FileManagement):
procedure GetNoOfFilesInFolder(): Integer
var
DirectoryInfo: DotNet DirectoryInfo;
Directory: DotNet Directory;
begin
IF NOT Directory.Exists(pathToFolder) THEN
EXIT(-1);
DirectoryInfo := DirectoryInfo.DirectoryInfo(pathToFolder);
EXIT(DirectoryInfo.GetFiles().Length);
end;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您确实可以为此使用
文件管理
codunit,但是它只能删除直接依赖性。文件管理
只是围绕相同dotnet组件的包装器。在所有情况下,如果要使用文件系统,则需要在
app.json
中将target
设置为 onprem 。以下代码应与您的示例相同:
You can indeed use the
File Management
codeunit for that, however it only removes the direct DotNet dependency.File Management
is just a wrapper around the very same DotNet assemblies.Under all circumstances if you are to work with the file system you are required to set
target
toOnPrem
in yourapp.json
.The following code should accomplish the same as your example: