dotnet / dotnet/dotnet-api-docs

Example in Object.MemberwiseClone method is obsolete

Open
#7,805 1 comment 0 reactions 0 assignees View on GitHub
area-System.Runtime Pri3 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

The method [```string.Copy()```](https://docs.microsoft.com/pt-br/dotnet/api/system.string.copy) in the [Object.MemberwiseClone](https://docs.microsoft.com/en-us/dotnet/api/system.object.memberwiseclone) example's obsolete because it's not used to create mutable strings.

```csharp
public Person DeepCopy()
{
Person other = (Person) this.MemberwiseClone();
other.IdInfo = new IdInfo(IdInfo.IdNumber);
other.Name = String.Copy(Name);
return other;
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.