Public properties can be used as named parameters : Property « Class « Visual C++ .NET






Public properties can be used as named parameters

 
#include "stdafx.h"
using namespace System;

[AttributeUsageAttribute(AttributeTargets::Assembly | AttributeTargets::Class)]
public ref class OwnerAttribute : Attribute
{
   public:
      property String^ DevOwner;
      property String^ TestOwner;

      OwnerAttribute() { }

};

[ Owner(DevOwner="John") ]
ref class C2
{
};


int main()
{
    Attribute^ attribute = Attribute::GetCustomAttribute( C2::typeid,OwnerAttribute::typeid);
    if (attribute != nullptr)
    {
         Console::WriteLine("{0}", attribute);
    }
}

   
  








Related examples in the same category

1.Array Property
2.Static Property
3.Scalar number Property
4.Defining Index Properties
5.Indexed properties
6.Indexed properties 2
7.Property accessor delegate
8.Static property
9.Declaring properties
10.Write only property
11.Virtual properties