Command.Collection 屬性
命名空間: EnvDTE
組件: EnvDTE (在 EnvDTE.dll 中)
語法
'宣告
ReadOnly Property Collection As Commands
Commands Collection { get; }
property Commands^ Collection {
Commands^ get ();
}
abstract Collection : Commands
function get Collection () : Commands
屬性值
型別:EnvDTE.Commands
Commands 集合。
範例
public void CodeExample(DTE2 dte, AddIn addin)
{
try
{
// Show number of commands in Commands collection.
MessageBox.Show(dte.Commands.Count.ToString());
// Return the Commands collection for the application.
Commands cmdsColl = dte.Commands;
// Return a Command object.
Command cmdObj = cmdsColl.Item("File.NewFile", cmdsColl.Count);
// Show the full name of Command object's application object.
MessageBox.Show(cmdObj.DTE.FullName);
// Display the Command object's name.
MessageBox.Show(cmdObj.Name);
// Display whether the Command object's containing collection
// is the same as the application object's Commands collection.
string message;
if (cmdsColl.Equals(cmdObj.Collection))
message = "Same collection!";
else
message = "Different collection!";
MessageBox.Show(message);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。