-2

A very simple question but one I cannot find documentation to purely because searching for ^ in c# returns irrelevant results. PS. I've never worked with c# before and this world is completely new to me.

I am working on C++ managed code which contains c# to interface with an external application. I found variable definitions (like IElement^% oElement) all over the place. Initially, I thought the '^' operator meant that I was defining a pointer but looking at pointer definition in ms docs shows that is not true. Removing the ^ operator (for ex.) gives me the following intellisense error -> "IntelliSense: a variable cannot have a C++/CLI interface class type"

Looking up the c++/cli interface gives some information on the type of code framework I'm working on but didn't mention what those symbols do. So, what do the symbols ^ and % do in this context?

Edit: Question topic changed from c# to C++/CLI

  • 1
    Don't think that answer is correct because the question is wrong, I think what the user is asking is what `^` means in C++/CLI (object handle). https://learn.microsoft.com/en-us/cpp/extensions/handle-to-object-operator-hat-cpp-component-extensions?view=vs-2019 – Gusman Jun 19 '20 at 02:57
  • 1
    @Gusman Ah I think you might be right. Apologies Prashanth, I've reopened your question. – ProgrammingLlama Jun 19 '20 at 02:59
  • 1
    The answers to this question will likely help: https://stackoverflow.com/questions/202463/what-does-the-caret-mean-in-c-cli – Kev Jun 19 '20 at 03:00
  • 1
    @Gusman, Kev (can't notify more than one user simultaneously) Thanks a lot, the links definitely clarify things. I should have been clearer in the question title. Didn't realize that c# had a ^ operator! – speed_of_light Jun 19 '20 at 03:11

1 Answers1

-1

^ is the bitwise XOR operator when used the numbers and booleans and % is the modulo operator

Gekctek
  • 1,161
  • 2
  • 12
  • 23
  • Thanks for responding, but my question was wrongly framed. I've updated the question since. Apologies for wasting your time. PS. I think the links in the comment section serve as a good start to getting a deeper understanding of the question. – speed_of_light Jun 19 '20 at 04:29