Skip to content

Commit

Permalink
Import System.Guid and System.Type.Guid documentation (#9715)
Browse files Browse the repository at this point in the history
* Import System.Guid and System.Type.Guid documentation

- Clarify that Type.Guid is COM-interop specific
- Delete COM-interop specific sample from System.Guid. This sample is
  not directly relevant to Guid type and there are other similar samples
  on GuidAttribute.

* Delete unused snippets
  • Loading branch information
jkotas authored Mar 15, 2024
1 parent e106740 commit 717df1d
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 220 deletions.
52 changes: 0 additions & 52 deletions snippets/cpp/VS_Snippets_CLR/Guid/CPP/Guids.cpp

This file was deleted.

45 changes: 0 additions & 45 deletions snippets/csharp/System/Guid/Overview/Guids.cs

This file was deleted.

8 changes: 0 additions & 8 deletions snippets/csharp/System/Guid/Overview/Project.csproj

This file was deleted.

41 changes: 0 additions & 41 deletions snippets/fsharp/System/Guid/Overview/Guids.fs

This file was deleted.

10 changes: 0 additions & 10 deletions snippets/fsharp/System/Guid/Overview/fs.fsproj

This file was deleted.

50 changes: 0 additions & 50 deletions snippets/visualbasic/VS_Snippets_CLR/Guid/VB/Guids.vb

This file was deleted.

12 changes: 0 additions & 12 deletions xml/System/Guid.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,18 +114,6 @@
## Remarks
A GUID is a 128-bit integer (16 bytes) that can be used across all computers and networks wherever a unique identifier is required. Such an identifier has a very low probability of being duplicated.
## Examples
The following example uses the <xref:System.Runtime.InteropServices.GuidAttribute?displayProperty=nameWithType> class to assign a GUID to an interface and to a user-defined class. It retrieves the value of the GUID by calling the <xref:System.Attribute.GetCustomAttribute%2A> method, and compares it with two other GUIDs to determine whether they are equal.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_CLR/Guid/CPP/Guids.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System/Guid/Overview/Guids.cs" interactive="try-dotnet" id="Snippet1":::
:::code language="fsharp" source="~/snippets/fsharp/System/Guid/Overview/Guids.fs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_CLR/Guid/VB/Guids.vb" id="Snippet1":::
Note that the <xref:System.Runtime.InteropServices.GuidAttribute> attribute is typically used in an application to expose a type to COM. If you compile this example, you can run the [Assembly Registration tool (Regasm.exe)](/dotnet/framework/tools/regasm-exe-assembly-registration-tool) on the generated assembly to create registry (.reg) and type library (.tlb) files. The .reg file can be used to register the coclass in the registry, and the .tlb file can provide metadata for COM interop.
]]></format>
</remarks>
</Docs>
Expand Down
4 changes: 2 additions & 2 deletions xml/System/Type.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11038,9 +11038,9 @@ Calling this method overload is the same as calling the <xref:System.Type.GetTyp
<format type="text/markdown"><![CDATA[

## Remarks
A GUID is associated with a type using the <xref:System.Runtime.InteropServices.GuidAttribute> attribute.

This property returns a GUID that's associated with a type using the <xref:System.Runtime.InteropServices.GuidAttribute> attribute. If the attribute is omitted, a GUID is assigned automatically.

The GUID returned by this property is typically used to expose a type to COM. It is not meant to be used as a unique identifier of the type.

## Examples
The following example creates the class `MyClass1` with a public method, creates a `Type` object corresponding to `MyClass1`, and gets the <xref:System.Guid> structure using the `GUID` property of the `Type` class.
Expand Down

0 comments on commit 717df1d

Please sign in to comment.