Hi, am using C# to program. I declared my property as below
public decimal sal(string amount)
{ get{return sal;}}

Now on running I got the error
sal is declared as property not method

What should I do?

Recommended Answers

All 2 Replies

Sure that's wrong!
What shall you write a method or a property??

Method

public decimal sal(string amount)
{ 
//your method body
//return value/variable
}

Property

public decimal sal
{ get{return sal;}}

ok there is a difference between properties, indexes and method I advise u should to see a OO tutorial

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.