有没有像 C# 中那样创建具有多个变量的开关的方法?像这样的东西..
switch((_dim1,_dim2,_dim3))
{
case(1, ""):
Info("1 is null");
case (2, ""):
Info("2 is null");
case (3, ""):
break;
}
Run Code Online (Sandbox Code Playgroud) 我需要将一个布尔变量从一个类传递到另一个类。我怎样才能存档这个?我有 2 个类,一个类创建并设置布尔值,另一个类需要获取该值。这都是因为我需要在不同形式的真实值上运行代码。我应该如何在这里声明新的 classB ?它不允许我使用我的类 ProdParmReportFinishedWG_Extension。
[ExtensionOf(formStr(ProdParmReportFinished))]
final class ProdParmReportFinishedWG_Extension
{
public boolean TestB;
public boolean parmIsTest(boolean _test = TestB)
{
TestB = _test;
return TestB;
}
public void run()
{
next run();
if(TestB)
{
Ok.enabled(false);
Info("@SRM:SRM00049");
}
else
{
Info('im false');
}
}
}
[ExtensionOf(formdatasourcestr(ProdTableListPage, ProdTable))]
final class ProdParmReportFinishedActiveWG_Extension
{
public boolean Test;
public int active()
{
int ret;
next Active();
ProdTable tableBuffer = this.cursor();
ProdTable prodtable;
ProdParmReportFinishedWG_Extension ClassB = new ProdParmReportFinishedWG_Extension();
;
if(tableBuffer.ProdId == tableBuffer.CollectRefProdId
&& tableBuffer.ProdStatus != …Run Code Online (Sandbox Code Playgroud) 有人可以告诉我我的代码有什么问题吗?我想将多个 xml 压缩到一个文件中,但结果文件始终为空。
using (MemoryStream zipStream = new MemoryStream())
{
using (ZipArchive zip = new ZipArchive(zipStream, ZipArchiveMode.Create, true))
{
string[] xmls = Directory.GetFiles(@"c:\temp\test", "*.xml");
foreach (string xml in xmls)
{
var file = zip.CreateEntry(xml);
using (var entryStream = file.Open())
using (var streamWriter = new StreamWriter(entryStream))
{
streamWriter.Write(xml);
}
}
}
using (FileStream fs = new FileStream(@"C:\Temp\test.zip", FileMode.Create))
{
zipStream.Position = 0;
zipStream.CopyTo(fs);
}
}
Run Code Online (Sandbox Code Playgroud)