这是我的代码需要做的图片.
Before Call:
+----+
| -9 |
+----+
/ \
/ \
+----+ +----+
| 3 | | 15 |
+----+ +----+
/ / \
/ / \
+----+ +----+ +----+
| 0 | | 12 | | 24 |
+----+ +----+ +----+
/ \
/ \
+----+ +----+
| 6 | | -3 |
+----+ +----+
After Call:
+----+
| -9 |
+----+
/ \
/ \
+----+ +----+
| 6 | | 30 |
+----+ +----+
/ / …Run Code Online (Sandbox Code Playgroud) 我试图通过FFMPEG使用以下命令将avi视频文件转换为flv格式:
-i C:\files\input\test.avi -y -ab 448k -ar 48000 -vcodec mpeg4 -s 640x480 -f flv C:\files\output\test.flv
Run Code Online (Sandbox Code Playgroud)
以下是我从ffmpeg获得的回复:
输入:
Input #0, avi, from 'C:\files\input\test.avi':
Metadata:
encoder : VirtualDubMod 1.5.10.2 (build 2540/release)
Duration: 00:01:00.00, start: 0.000000, bitrate: 1813 kb/s
Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 640x272 [SAR 1:1 DAR 40:17], 25 tbr, 25 tbn, 25 tbc
Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), s16, 448 kb/s
Run Code Online (Sandbox Code Playgroud)
输出:
Output #0, flv, to 'C:\files\output\test.flv':
Metadata:
encoder …Run Code Online (Sandbox Code Playgroud) 我需要在我作为迭代器(使用yield)实现的方法中做一些繁重的、有点脆弱的逻辑:
public IEnumerable<Things> GetMoreThings() {
while (goodStuffHappens()) {
Things moreThingsIWant = TemptFateAgain();
if (moreThingsIWant.Any())
yield return moreThingsIWant;
}
}
Run Code Online (Sandbox Code Playgroud)
在调用方法中,我需要将调用包装GetMoreThings在try/catch和yield return结果中:
try {
foreach (Things thing in Helpful.GetMoreThings())
yield return thing;
}
catch (Exception e) {
//crash, burn
}
Run Code Online (Sandbox Code Playgroud)
发起人会立即意识到这是不可能的 -在try/catch块(只有try/ finally)内没有诸如 yield 之类的东西。
有什么建议吗?
使用我编写的 .NET Standard DLL 有一个有效的 ASP.NET Core。我现在想TransactionScope在我的 DLL 中使用,但是遇到了这个问题:
.NET Standard 和 .NET Core 2.0 都可以识别 System.Transactions,但 .NET Framework 4.6.1 出现错误并且无法使用 MSBuild 进行编译。Visual Studio 2017 提供以下有用信息:
我似乎无法找到强制项目从系统的 Framework/Framework64 文件夹中识别 System.Transactions.dll 的方法。
是的,我可以dotnet build用来编译 .NET Core 版本,但这不是我想要的......我也希望能够编译 .NET 4.6.1。
我正在尝试将其转换为C#代码:
等待5秒钟,然后借记银行帐户.
我有一种感觉,我很接近......但这不起作用.我这样做是对的吗?
public override void Process(BankAccount b, decimal amount)
{
DateTime present = DateTime.Now;
DateTime addFiveSeconds = DateTime.Now.AddSeconds(5);
if (present != addFiveSeconds)
{
this.Status = TransactionStatus.Pending;
}
else
{
b.Debit(amount);
this.Status = TransactionStatus.Complete;
}
}
Run Code Online (Sandbox Code Playgroud)