几年前,我根据 ReSharper 的一些建议开始使用方法组语法,最近我尝试了ClrHeapAllocationAnalyzer,它标记了我在 lambda 中使用方法组的每个位置的问题HAA0603 - This will allocate a delegate instance
。
由于我很好奇这个建议是否真的有用,我为这两种情况编写了一个简单的控制台应用程序。
代码1:
class Program
{
static void Main(string[] args)
{
var temp = args.AsEnumerable();
for (int i = 0; i < 10_000_000; i++)
{
temp = temp.Select(x => Foo(x));
}
Console.ReadKey();
}
private static string Foo(string x)
{
return x;
}
}
Run Code Online (Sandbox Code Playgroud)
代码2:
class Program
{
static void Main(string[] args)
{
var temp = args.AsEnumerable();
for (int i = 0; i < 10_000_000; i++) …
Run Code Online (Sandbox Code Playgroud) 我知道IsOverflowOpen和HasOverflowItems属性,但我正在寻找一种方法来判断项目(按钮,radiobutton ...)是否已移入ToolBarOverflowPanel,因此我可以使用触发器来更改其样式.
我需要这个能够重现一些UWP工具栏样式(Windows 10 Mail,Word,Excel ...).我已经成功地复制了大部分风格,唯一缺少的是能够在溢出面板中改变我的项目的样式.