Search code examples
c#visual-studio-2015c++-cli

Convert from c# to C++/CLI VS2015


I have following codes in C# to get month names.


    string[] names = DateTimeFormatInfo.CurrentInfo.MonthNames;

When I try to convert by following ways


    cli::array MyMnNames= DateTimeFormatInfo::CurrentInfo->MonthNames;

    cli::array^ MyMnNames = DateTimeFormatInfo::CurrentInfo->MonthNames;

But in C++/CLI, I cannot convert...any helps or guidances.. Thanks


Solution

  • using namespace System;
    using namespace System::Globalization;
    
    int main()
    {
        array<String^> ^months = DateTimeFormatInfo::CurrentInfo->MonthNames;
    }