共用方式為


IVsSimpleObjectList2.CanRename Method

Returns a flag indicating if the given list item can be renamed.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop.8.0 (in Microsoft.VisualStudio.Shell.Interop.8.0.dll)

Syntax

'宣告
Function CanRename ( _
    index As UInteger, _
    pszNewName As String, _
    <OutAttribute> ByRef pfOK As Integer _
) As Integer
'用途
Dim instance As IVsSimpleObjectList2
Dim index As UInteger
Dim pszNewName As String
Dim pfOK As Integer
Dim returnValue As Integer

returnValue = instance.CanRename(index, _
    pszNewName, pfOK)
int CanRename(
    uint index,
    string pszNewName,
    out int pfOK
)
int CanRename(
    [InAttribute] unsigned int index, 
    [InAttribute] String^ pszNewName, 
    [OutAttribute] int% pfOK
)
abstract CanRename : 
        index:uint32 * 
        pszNewName:string * 
        pfOK:int byref -> int 
function CanRename(
    index : uint, 
    pszNewName : String, 
    pfOK : int
) : int

Parameters

  • index
    Type: System.UInt32
    [in] Specifies the index of the list item of interest.
  • pszNewName
    Type: System.String
    [in] Pointer to a null-terminated string containing the new name.
  • pfOK
    Type: System.Int32%
    [out] Pointer to a flag indicating whether an item can be renamed.

Return Value

Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From vsshell80.idl:

HRESULT IVsSimpleObjectList2::CanRename(
   [in] ULONG     Index, 
   [in] LPCOLESTR pszNewName, 
   [out] BOOL*    pfOK
);

Return pfOK to indicate whether the item Index can be renamed. If the passed in pszNewName is nulla null reference (Nothing in Visual Basic), you simply answer the general question of whether or not that item supports rename (return true or false). If pszNewName is non-null, do validation of the new name and return true if successful rename with that new name is possible or an error in hr (along with false) if the name is somehow invalid and set the rich error info to indicate to the user what was wrong.

.NET Framework Security

See Also

Reference

IVsSimpleObjectList2 Interface

IVsSimpleObjectList2 Members

Microsoft.VisualStudio.Shell.Interop Namespace