Note: Forums will be making significant UX changes to address key usability improvements surrounding search, discoverability and navigation. To learn more about these changes please visit the announcement which can be found HERE.
how to modify the value type data which is parameter passed into function?

الإجابة how to modify the value type data which is parameter passed into function?

  • 2012년 4월 28일 토요일 오전 3:40
     
     

    If I want to modify the value type data ,which is passed into function as paramter,in function,what can I do?

    I am intent to box the data in order to consider it as a ref type,but it is readonly.

    Now I have to pass it out as a return value;

모든 응답

  • 2012년 4월 28일 토요일 오전 5:26
    중재자
     
     

    Could you please describe your question in more detail?

    You can modify the value type data just as what you did in traditional c++ application.

    For example,  You create a winrt lib and define follow function:

    public bool func1(int* param1);

    Then you can modify the value of param1 in func1. You can call func1 in your  C# metro style application:

    func1(out param1);

    Best Regards,

    Han Xia


  • 2012년 4월 28일 토요일 오전 6:13
     
     

    Readonly Variable or Object doesn't have set property..

    So ,you can't change it's value.

    It never be as reference type...

    You can't change value type of object at runtime


    Please, If answer match your requirement then set mark as answer

  • 2012년 4월 30일 월요일 오전 7:38
    중재자
     
     답변됨

    Hello,

    Please describe your question detail.

    Do you want to use reference to in C++/CX? if so, you can use % instead of & in native C++. Please check this document.
    http://msdn.microsoft.com/en-us/library/windows/apps/br212455.aspx

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us