CodeFunction2.Prototype 屬性
取得保存此物件之 Stub 定義的字串。
命名空間: EnvDTE80
組件: EnvDTE80 (在 EnvDTE80.dll 中)
語法
'宣告
ReadOnly Property Prototype ( _
Flags As Integer _
) As String
string this[
int Flags
] { get; }
property String^ Prototype[[InAttribute] int Flags] {
String^ get ([InAttribute] int Flags);
}
abstract Prototype :
Flags:int -> string with get
JScript 不支援索引屬性。
參數
Flags
類型:Int32選擇項。 指出字串內容的 vsCMPrototype 值,例如只有參數名稱、參數類型、整個不重複的簽章等等。 根據預設,所有旗標是設為 Off。
屬性值
類型:String
此 CodeFunction 的 Stub 定義。
備註
![]() |
---|
像是類別、結構、函式、屬性、委派等程式碼模型項目的值,在執行特定類型的編輯後,可能會不具決定性,這表示它們的值不能指望會一律保持相同。有关详细信息,请参阅代码模型元素的值可以更改中的部分 使用程式碼模型探索程式碼 (Visual Basic)。 |
範例
Sub PrototypeExample(ByVal dte As DTE2)
' Before running this example, open a code document from a project
' and place the insertion point inside a function.
Try
' Retrieve the CodeFunction at the insertion point.
Dim sel As TextSelection = _
CType(dte.ActiveDocument.Selection, TextSelection)
Dim fun As CodeFunction = _
CType(sel.ActivePoint.CodeElement( _
vsCMElement.vsCMElementFunction), CodeFunction)
Dim ovrloads As String
If fun.IsOverloaded Then
' Display all the overloads.
Dim ovrload As CodeFunction
For Each ovrload In fun.Overloads
ovrloads &= ovrload.Prototype( _
vsCMPrototype.vsCMPrototypeParamNames Or _
vsCMPrototype.vsCMPrototypeParamTypes Or _
vsCMPrototype.vsCMPrototypeType) & vbCrLf
Next
MsgBox(fun.Name & " has the following overloads:" & _
vbCrLf & vbCrLf & ovrloads)
Else
MsgBox(fun.Name & " isn't overloaded.")
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
public void PrototypeExample(DTE2 dte)
{
// Before running this example, open a code document from a project
// and place the insertion point inside a function.
try
{
// Retrieve the CodeFunction at the insertion point.
TextSelection sel =
(TextSelection)dte.ActiveDocument.Selection;
CodeFunction fun =
(CodeFunction)sel.ActivePoint.get_CodeElement(
vsCMElement.vsCMElementFunction);
string ovrloads = "";
if (fun.IsOverloaded)
{
// Display all the overloads.
foreach (CodeFunction ovrload in fun.Overloads)
{
ovrloads += ovrload.get_Prototype(
(int)(vsCMPrototype.vsCMPrototypeParamNames |
vsCMPrototype.vsCMPrototypeParamTypes |
vsCMPrototype.vsCMPrototypeType)) + "\n";
}
MessageBox.Show(fun.Name +
" has the following overloads:\n\n" + ovrloads);
}
else
{
MessageBox.Show(fun.Name + " isn't overloaded.");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。