MemberAttribute problem in codedom .Cannot find the right one!


Hi guys,
Happy new year to all of you first.

I am trying to generate some methods that Implement an interface.

EG
I want to something that lookLike Implementing the IEmployee interface without the "Public" modifier


IList<Employee> IEmployee.GetEmployeeList()
{
}

I do the following

private CodeMemberMethod GetEmployeeList()
{
CodeMemberMethod GetEmpList = new CodeMemberMethod();
GetEmpList.Name = "IEmployee.GetEmployeeList";
GetEmpList.Attributes = MemberAttributes.Public | MemberAttributes.Final;
CodeTypeReference IListType = new CodeTypeReference("IList", new CodeTypeReference("Employee"));
GetEmpList.ReturnType = IListType;

return GetEmpList;
}
this produces
public IList<Employee> IEmployee.GetEmployeeList()
{
}

The Problem is with the MemberAttributes.Which one should I use in order not to have any modifiers I have tried them all.

Also in order to produce something like " IEmployee.GetEmployeeList"I have just put them in a string is this the way to do it


Thanks in advance




Answer this question

MemberAttribute problem in codedom .Cannot find the right one!

  • Alan Wolfe

    Try:
    GetEmpList.Attributes = MemberAttributes.Final;



  • jamie r

    Hi

    Thanks a lot .That worked.Beleive me I tried them all but final.Thanks



  • MemberAttribute problem in codedom .Cannot find the right one!