dotnet / dotnet/dotnet-api-docs

In DeepCopy, if you have to copy the string, then what is MemberwiseClone doing?

Open
#1,075 0 comments 1 reaction 0 assignees View on GitHub
area-System.Runtime dotnet-api/prod Pri2 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

Why do you have to manually copy values over if you have already called MemberwiseClone?

other.Name = String.Copy(Name);

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: e10c524e-0f81-cfa4-5ce9-6855c049c1e4
* Version Independent ID: 747f5fd4-cace-1476-77e4-5839b96dcaf0
* Content: [Object.MemberwiseClone Method (System)](https://docs.microsoft.com/en-us/dotnet/api/system.object.memberwiseclone?view=netframework-4.7.2)
* Content Source: [xml/System/Object.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System/Object.xml)
* Product: **dotnet-api**
* GitHub Login: @dotnet-bot
* Microsoft Alias: **dotnetcontent**

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.