String Copy() - C# Tutorial
C# Course / Strings / String Copy()

String Copy()

BLUF: Mastering String Copy() is essential for building robust applications with the .NET ecosystem. This tutorial provides clear explanations and practical examples to help you understand and apply this C# concept.
Enterprise Development Tip: String Copy()

C# is a powerful, modern language for enterprise solutions. Discover how String Copy() enhances your development workflow in the guide below.

The C# Copy function is employed to generate a fresh String instance containing the identical value as a designated String. This method is a static member of the String class and returns a string data type.

Signature

Example

public static string Copy(String str)

Parameter

The str function requires a string parameter to duplicate a given string.

Return

It returns string object.

C# String Copy Method Example

Example

using System;  
    public class StringExample  
    {  
        public static void Main(string[] args)  
        {  
             string s1 = "Hello ";  
             string s2 = string.Copy(s1);
             Console.WriteLine(s1);
             Console.WriteLine(s2);
        }  
    }

Output:

Output

Hello
Hello

Input Required

This code uses input(). Please provide values below:

Logic Practice
Install Logic Practice
Add to home screen for a faster app-like experience