السلام عليكــم ورحمـة الله وبركاتــه ،،
كيف حالكم؟؟
أخواني لدي مشكله في عمل
private calss
أرجو منكم المساعده في شرح المشكله وحلها
الكود التالي هو البرايفت
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace privateClass
{
class person
{
private String FirstName = "";
public void setFirstName(String value)
{
FirstName = value;
}
public string getFirstName()
{
return FirstName.ToUpper();
}
public String SecondName = "";
public int Age = 0;
public String AcademicYear = "";
private string Gender = "";
public void setGender(String value)
{
if (value.Startwith("F"))
{
Gender = "Famel";
}
else
Gender = "Male";
}
public string getGender()
{
return Gender;
}
}
}ثم كود الببلك في كلاس خاص به
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace privateClass
{
class Program
{
static void Main(string[] args)
{
person[] people = new person[3];
for (int i = 0; i < people.Length; i++)
{
people = new person();
}
people[0].setFirstName = "Hanaan";
people[0].SecondName = "Salah";
people[0].Age = 20;
people[0].AcademicYear = "sophomre";
people[0].setGender = "Famel";
foreach (person myperson in people)
{
Console.WriteLine(myperson.setFirstName+""+myperson.SecondName+""+myperson.Age+""+myperson.AcademicYear+""+myperson.setGender);
}
}
}
}المشكله هي
cannot assign to 'setFirstName'because it is a 'method group'
cannot assign to 'setGendar'because it is a 'method group'
string doesn't contain adefinition for 'Startwith'and no extension method 'Startwith' accepting a first argument of type 'string' could be found
اذا كان هناك من لديه القدرة على مساعدتي فليتكرم علي بذالك وساكون له من الشاكرين
تحياتي لكم جميعا