C# Function question
- From: "Scott Schaffer" <scottpschaffer@xxxxxxxxx>
- Date: Tue, 20 Sep 2005 13:13:43 -0400
Hello,
This should be a simple problem to solve, but I'm fairly new to C# and
have been wracking my brains to no avail. I created a new Console
Application in C# beta 2, and entered the following:
using System;
using System.Collections.Generic;
using System.Text;
namespace Test2
{
class Program
{
static void main (string[] args)
{
string a = "qwert";
string b = GetStuff( );
string c = a + b;
Console.WriteLine(c);
}
public string GetStuff( )
{
string c = "poiuy";
return c;
}
}
}
When I compile this, I get the error: "An object reference is required
for the nonstatic field, method, or property 'Test2.Program.GetStuff( )' for
the line: string b = GetStuff( );
I'm not entirely sure what the problem could be, and would appreciate it
if someone help. Thanks.
Scott
.
- Follow-Ups:
- Re: C# Function question
- From: Lasse Vågsæther Karlsen
- Re: C# Function question
- Prev by Date: Re: Invalid Length for Base-64 string problem
- Next by Date: Re: Fast binary serialization/deserialization of object
- Previous by thread: Re: Invalid Length for Base-64 string problem
- Next by thread: Re: C# Function question
- Index(es):
Relevant Pages
|