using System.Text;
namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            Cassandra myObject = new Cassandra();
            string a ="söt";
            myObject.hejsan(a);
            System.Console.WriteLine(a);
            Console.ReadLine();
        } 
    }


class Cassandra
        {
            public string hejsan(string value)
            {
                value +="Cassnadra";
                return value;
            }
        }


}

how come this wont work? all i get is "söt" as output when i should get "sötCassandra"
thanks for answers :)

using System.Text;
namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            Cassandra myObject = new Cassandra();
            string a ="söt";
            a = myObject.hejsan(a);
            System.Console.WriteLine(a);
            Console.ReadLine();
        } 
    }
class Cassandra
        {
            public string hejsan(string value)
            {
                value +="Cassnadra";
                return value;
            }
        }
}

Line 10, you need to assign a to be the output of the method, as I have done in the above code.

hmm now i just get "An unhandled exception of type 'System.StackOverflowException' occurred in ConsoleApplication3.exe" sigh? :D warning me if i have any infinite loops or something like that :O

This question has already been answered. Start a new discussion instead.