kingtak
یک شنبه 04 دی 1390, 00:05 صبح
سلام دوستان
من تازه دارم C# یاد میگیرم.یه مشکل در مورد متد ها دارم.
کامپایلر ویژوال استادیو تو لاین 14 این پیغام رو میده:
An object reference is required for the nonstatic field, method, or property property 'consoleApplaction3.program1.zarbValu(int,int)'...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication3
{
class Program1
{
static void Main(string[] args)
{
int m = 5;
int n = 7;
zarbValu(m, n);
}
private void zarbValu(int m,int n)
{
int result=m * n;
Console.WriteLine("the result is:{0}", result);
return;
}
}
}
من تازه دارم C# یاد میگیرم.یه مشکل در مورد متد ها دارم.
کامپایلر ویژوال استادیو تو لاین 14 این پیغام رو میده:
An object reference is required for the nonstatic field, method, or property property 'consoleApplaction3.program1.zarbValu(int,int)'...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication3
{
class Program1
{
static void Main(string[] args)
{
int m = 5;
int n = 7;
zarbValu(m, n);
}
private void zarbValu(int m,int n)
{
int result=m * n;
Console.WriteLine("the result is:{0}", result);
return;
}
}
}