Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. Is every C# feature available in C++/Managed ?

Is every C# feature available in C++/Managed ?

Scheduled Pinned Locked Moved Managed C++/CLI
csharpc++linqcomtutorial
3 Posts 3 Posters 10 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Maximilien
    wrote on last edited by
    #1

    I am looking at some MSDN documentation and the "C++" code example are empty with the message "No code example is currently available or this language may not be supported." Is it because the feature is not available in C++ or that is is just not "documented with code examples" The thing I am looking at is Enumerable::ToDictionary see the MSDN documentation : [Enumerable.ToDictionary(TSource, TKey) Method (IEnumerable(TSource), Func(TSource, TKey)) (System.Linq)](https://msdn.microsoft.com/en-us/library/bb549277.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-2) There is not C++ example. Is it possible to convert that code to C++ ? Thanks.

    I'd rather be phishing!

    L J 2 Replies Last reply
    0
    • M Maximilien

      I am looking at some MSDN documentation and the "C++" code example are empty with the message "No code example is currently available or this language may not be supported." Is it because the feature is not available in C++ or that is is just not "documented with code examples" The thing I am looking at is Enumerable::ToDictionary see the MSDN documentation : [Enumerable.ToDictionary(TSource, TKey) Method (IEnumerable(TSource), Func(TSource, TKey)) (System.Linq)](https://msdn.microsoft.com/en-us/library/bb549277.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-2) There is not C++ example. Is it possible to convert that code to C++ ? Thanks.

      I'd rather be phishing!

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Maximilien wrote:

      Is it possible to convert that code to C++ ?

      Not easily as C++ has no simple IEnumerable class. However you may be able to adapt one of the other STL collection classes. See Standard C++ Library Reference[^].

      1 Reply Last reply
      0
      • M Maximilien

        I am looking at some MSDN documentation and the "C++" code example are empty with the message "No code example is currently available or this language may not be supported." Is it because the feature is not available in C++ or that is is just not "documented with code examples" The thing I am looking at is Enumerable::ToDictionary see the MSDN documentation : [Enumerable.ToDictionary(TSource, TKey) Method (IEnumerable(TSource), Func(TSource, TKey)) (System.Linq)](https://msdn.microsoft.com/en-us/library/bb549277.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-2) There is not C++ example. Is it possible to convert that code to C++ ? Thanks.

        I'd rather be phishing!

        J Offline
        J Offline
        John Schroedl
        wrote on last edited by
        #3

        Since Linq was designed as a C# language feature, many uses of it don't include a C++/CLI example in my experience. I have used it from C++/CLI however but it takes a bit of tinkering. Here's one example from a simple utility I had where I used ToList() which is probably similar to ToDictionary().

        List^ files = Linq::Enumerable::ToList(Directory::EnumerateFiles(dataDir, "*.dat"));
        int count = Linq::Enumerable::Count(files);

        I've not yet encountered something managed which just could not be done from C++/CLI. But, the C# syntax is often more direct.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups