Bagikan melalui


IVsObjectList.CanRename Method

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

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

Syntax

'Declaration
Function CanRename ( _
    index As UInteger, _
    pszNewName As String, _
    <OutAttribute> ByRef pfOK As Integer _
) As Integer
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 vsshell.idl:

HRESULT IVsObjectList::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

IVsObjectList Interface

Microsoft.VisualStudio.Shell.Interop Namespace