diff --git a/samples/snippets/fsharp/VS_Snippets_CLR/AttrTargs/FS/attrtargs.fs b/samples/snippets/fsharp/VS_Snippets_CLR/AttrTargs/FS/attrtargs.fs new file mode 100644 index 00000000000..bc6b96b1494 --- /dev/null +++ b/samples/snippets/fsharp/VS_Snippets_CLR/AttrTargs/FS/attrtargs.fs @@ -0,0 +1,54 @@ +// +open System + +// This attribute is only valid on a class. +[] +type ClassTargetAttribute() = + inherit Attribute() + +// This attribute is only valid on a method. +[] +type MethodTargetAttribute() = + inherit Attribute() + +// This attribute is only valid on a constructor. +[] +type ConstructorTargetAttribute() = + inherit Attribute() + +// This attribute is only valid on a field. +[] +type FieldTargetAttribute() = + inherit Attribute() + +// This attribute is valid on a class or a method. +[] +type ClassMethodTargetAttribute() = + inherit Attribute() + +// This attribute is valid on a generic type parameter. +[] +type GenericParameterTargetAttribute() = + inherit Attribute() + +// This attribute is valid on any target. +[] +type AllTargetsAttribute() = + inherit Attribute() + +[] +[] +[] +type TestClassAttribute [] [] () = + [] + [] + let myInt = 0 + + [] + [] + [] + member _.Method1() = () + + member _.GenericMethod<[] 'T>(x: 'T) = () + +// \ No newline at end of file diff --git a/samples/snippets/fsharp/VS_Snippets_CLR/AttrTargs/FS/fs.fsproj b/samples/snippets/fsharp/VS_Snippets_CLR/AttrTargs/FS/fs.fsproj new file mode 100644 index 00000000000..56d76066c6d --- /dev/null +++ b/samples/snippets/fsharp/VS_Snippets_CLR/AttrTargs/FS/fs.fsproj @@ -0,0 +1,9 @@ + + + Exe + net6.0 + + + + + \ No newline at end of file diff --git a/xml/System/AttributeTargets.xml b/xml/System/AttributeTargets.xml index f559fc41bca..7559453cafb 100644 --- a/xml/System/AttributeTargets.xml +++ b/xml/System/AttributeTargets.xml @@ -72,6 +72,7 @@ :::code language="cpp" source="~/samples/snippets/cpp/VS_Snippets_CLR/AttrTargs/CPP/attrtargs.cpp" id="Snippet1"::: :::code language="csharp" source="~/samples/snippets/csharp/VS_Snippets_CLR/AttrTargs/CS/attrtargs.cs" id="Snippet1"::: + :::code language="fsharp" source="~/samples/snippets/fsharp/VS_Snippets_CLR/AttrTargs/FS/attrtargs.fs" id="Snippet1"::: :::code language="vb" source="~/samples/snippets/visualbasic/VS_Snippets_CLR/AttrTargs/VB/AttrTargs.vb" id="Snippet1"::: ]]>