A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

34 lines
962 B

using Avalonia.Controls;
using Avalonia.Markup.Parsers;
using BenchmarkDotNet.Attributes;
using System;
using System.Collections.Generic;
using System.Text;
namespace Avalonia.Benchmarks.Markup
{
[MemoryDiagnoser]
public class Parsing
{
[Benchmark]
public void ParseComplexSelector()
{
var selectorString = "ListBox > TextBox /template/ TextBlock[IsFocused=True]";
var parser = new SelectorParser((ns, s) =>
{
switch (s)
{
case "ListBox":
return typeof(ListBox);
case "TextBox":
return typeof(TextBox);
case "TextBlock":
return typeof(TextBlock);
default:
return null;
}
});
var selector = parser.Parse(selectorString);
}
}
}