在c#中从Dictionary中获取随机条目的最佳方法是什么?
我需要从字典中获取一些随机对象以显示在页面上,但是我不能使用以下内容,因为索引无法访问字典:
Random rand = new Random();
Dictionary< string, object> dict = GetDictionary();
return dict[rand.Next()];
Run Code Online (Sandbox Code Playgroud)
有什么建议?
我发现,当顶级小部件调用消息框对话框(例如“ showinfo”)时,将在顶级之上显示根窗口。有没有一种方法可以将“顶级”窗口设置为消息框对话框的主窗口?
这是一个重现此内容的脚本:
# -*- coding:utf-8 -*-
# PYTHON 3 ONLY
from tkinter import *
from tkinter import messagebox
root = Tk()
root.title('ROOT WINDOW')
Label(root, text = 'Place the toplevel window over the root window\nThen, push the button and you will see that the root window is again over the toplevel').grid()
topWindow = Toplevel(root)
topWindow.title('TOPLEVEL WINDOW')
Label(topWindow, text = 'This button will open a messagebox but will\ndo a "focus_force()" thing on the root window').grid()
Button(topWindow, text = '[Push me !]', …Run Code Online (Sandbox Code Playgroud) 我正在开发 Office 365 Outlook 加载项,我想将所有邮件保存在 .msg 文件中。
到目前为止,我阅读了此参考文献: https: //dev.outlook.com/reference/add-ins/,但没有找到任何允许我在 Javascript 中从邮件创建 .msg 文件的内容。
是否可以从 javascript 生成 .msg 文件?
我在 C# 中使用 ASP.NET MVC Web 服务器(稍后将在 Azure 上)来执行加载项,因此我可以使用任何 C# 包。我也无法支付任何插件或库的费用。
c# ×2
azure ×1
dictionary ×1
javascript ×1
messagebox ×1
python-3.x ×1
tk-toolkit ×1
tkinter ×1