Skip to content

Instantly share code, notes, and snippets.

@jskeet
Created November 2, 2018 15:53
Show Gist options
  • Save jskeet/b34519a73a485dee490397d37b4de3f5 to your computer and use it in GitHub Desktop.
Save jskeet/b34519a73a485dee490397d37b4de3f5 to your computer and use it in GitHub Desktop.
using System;
class Message
{
public string Body { get; set; }
public Message GetNewMessage()
{
return new Message
{
Body = Body
};
}
}
class Test
{
static void Main()
{
Message m1 = new Message { Body = "test" };
Message m2 = m1.GetNewMessage();
Console.WriteLine(m2.Body); // Prints test
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment