Describe the WinRT method signature RRS feed

  • Question

  • Please describe me the following method signature, shown by Object Browser:

    public : virtual Windows::Foundation::IAsyncAction^ DeleteAsync() new sealed = Windows::Storage::IStorageItem::DeleteAsync
        Member of Windows::Storage::StorageFile

    Deletes the current file.

    Return Values:
    No object or value is returned by this method when it completes.

    As I understand DeleteAsync() is a virtual method of class Windows::Storage::StorageFile.

    "sealed" indicates that it is a final implementation of method and can not be overridden by derived classes.

    I am not understand the purpose to declare the method as sealed where the class is defined as sealed.

    What is defined by keyword "new" and clause "= Windows::Storage::IStorageItem::DeleteAsync" I am not understand at all.



    Wednesday, March 20, 2013 1:51 PM


  • It's just a matter of how the Object Browser is interpreting the metadata.

    My guess is that "new" comes from the "newslot" marking in the metadata, which means (in essence) that it gets a new entry in the vtable and overrides any base class definitions (see ECMA 335 for more details).

    I suspect that "sealed" comes from the "final" marking in the metadata. The Object Browser covers more than just WinRT objects (e.g. .NET objects) such that things which seem obvious within the rules of WinRT aren't necessarily required in other rules.

    The "= Windows::Storage::IStorageItem::DeleteAsync" text tells you what base class/interface method this method is overriding. The StorageFile class implements five different interfaces so telling you where this method comes from might help provide further information on its purpose/intent.

    If in the Object Browser Settings (the gear icon) you click on "Show Inherited Member" then you will see StorageClass gain the Equals method which doesn't have new or sealed and doesn't have an "= ..." clause since it is inherited from Platform::Object, which is a unique class.

    XNA/DirectX MVP | Website | Blog | @mikebmcl

    • Edited by MikeBMcL Thursday, March 21, 2013 3:15 AM left in the word "either", which was a typo
    • Proposed as answer by MikeBMcL Thursday, March 21, 2013 3:15 AM
    • Marked as answer by Anatoly Bistritsky Thursday, March 21, 2013 7:43 AM
    Thursday, March 21, 2013 3:14 AM