我能够压缩最多1 GB的文件夹,但我必须压缩超过10 GB.
string filePath = C:\Work; // path of the source file
private void compressFile(string filePath)
{
using (ZipFile zip = new ZipFile())
{
zip.AddDirectory(Path.Combine(filePath, "Demo"));
if (File.Exists(Path.Combine(filePath, "Demo.zip")))
{
File.Delete(Path.Combine(filePath, "Demo.zip"));
zip.CompressionLevel = Ionic.Zlib.CompressionLevel.BestCompression;
zip.Save(Path.Combine(filePath, "Demo.zip"));
}
zip.Save(Path.Combine(filePath, "Demo.zip"));
}
}
Run Code Online (Sandbox Code Playgroud) 我有一个数组的数据,如下所示:
myArray=['0','1','2','3','4','5'];
现在我想在10秒后删除数组的每个第一个元素.我现在不是要求完整的代码我只想获得有关如何做到这一点的一些提示和建议.欢迎任何答案.
我认为这是不可能的,但不知何故你可以添加修饰符以enum不同于public.
这段代码工作得很好,并充当实际的私有成员(在包含 class 之外无法访问C:
namespace N {
public class C {
private enum E { ... }
}
}
Run Code Online (Sandbox Code Playgroud)
简短回答:尽可能少的访问(参见 Jon Skeet 的回答)。
长答案:
非嵌套类型、枚举和委托可访问性(可能只有内部或公共可访问性)
Run Code Online (Sandbox Code Playgroud)| Default | Permitted declared accessibilities ------------------------------------------------------------------ namespace | public | none (always implicitly public) enum | public | none (always implicitly public) interface | internal | public, internal class | internal | public, internal struct | internal | …
我正在使用VS 2017来开发我的.NET应用程序.我编写了以下代码来从api中的表中检索数据
[HttpGet]
[Route("Index")]
public IEnumerable<Strings> Index()
{
var list = db.Strings.Select(x => new { x.Iid, x.Value, x.Description, x.Itype }).ToList();
return list;
}
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
错误CS0266无法将类型'System.Collections.Generic.List <>'隐式转换为'System.Collections.Generic.IEnumerable'.存在显式转换(您是否错过了演员?)**
如何铸造是可能的?我已将IEnumerable更改为IList但问题仍然存在.我不想为此创建ViewModel.