我需要创建一个包含特定长度的小写字母和数字组合的列表,在这种情况下长度需要为9.例如:b0a6195c9 它只需要为该字符串长度生成组合,因此只有9个字符长的组合。
var buttonWithStyleFromLocalResources = button1; //button1 defined in XAML
var buttonWithStyleFromApplicationResources = button2; //button2 defined in XAML
ResourceDictionary localResourceDictionary = Resources;
//try to access local style with key "KeyForStyle"
if (localResourceDictionary.TryGetValue("KeyForStyle", out object value) && value is Style)
{
buttonWithStyleFromLocalResources.Style = (Style)value;
}
//try to access application style with key "KeyForStyle" (from App.xaml)
ResourceDictionary applicationResourceDictionary = Application.Current.Resources;
if (applicationResourceDictionary.TryGetValue("KeyForStyle", out value) && value is Style)
{
buttonWithStyleFromApplicationResources.Style = (Style)value;
}
我发现的一些正常工作的C代码可以解决问题,但是如果你提供小写字母和数字,它将生成那个长度的字符串。
这是所需的输出类型,但我不想要重复: