How to use C# string Clone

How to use C# string Clone

Clone() method creates and returns a copy of string object. The CSharp string Clone() method returns a reference to this instance of string.


using System;
using System.Windows.Forms;
namespace WindowsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            {
                string str = "Mahesh";
                string clonedString = null;
                clonedString = (String)str.Clone();
                MessageBox.Show (clonedString);
            }
        }
    }
}

0 comments:

Post a Comment