0

Tell me please what does ^ character in the code below:

[AttributeUsage (AttributeTargets::Class)]
public ref class ControlDescriptionAttribute : Attribute
{
public:
  ControlDescriptionAttribute (String ^name, String ^description) :
    _name (name),
    _description (description)
  {
  }

  property String ^Name
  {
    String ^get () { return _name; }
  }

  property String ^Description
  {
    String ^get () { return _description; }
  }

private:
  String
    ^ _name,
    ^ _description;
};

I have found it looking for something different, but have never met the usage of ^.

Nickon
  • 9,652
  • 12
  • 64
  • 119

2 Answers2

2

Can we start by telling you that is not C#? TOTALLY WRONG LANGUAGE - as you can see on the public ref. In C# that would be public class, not public ref class ;)

THat is C++/CLI and ^ is the indicator of a managed reference, the manged version of the unmanaged *

The properties erally are

String^ (managed pointer to a string).

TomTom
  • 61,059
  • 10
  • 88
  • 148
1

I think you have got it confused with C++/CLI. As far as i know its not a typical usage in C#.

In simple terms, its just a pointer. In MSDN terms its a managed pointer. :)

Some references that may help:

http://msdn.microsoft.com/en-us/library/te3ecsc8(VS.80).aspx

Also look at the link supplied in the comment by @Lloyd.

Why
  • 626
  • 11
  • 29