Click here to Skip to main content
15,906,766 members
Home / Discussions / C#
   

C#

 
QuestionDeclarations using var Pin
JBHowl16-Sep-15 1:54
JBHowl16-Sep-15 1:54 
AnswerRe: Declarations using var Pin
Eddy Vluggen16-Sep-15 2:16
professionalEddy Vluggen16-Sep-15 2:16 
AnswerRe: Declarations using var PinPopular
Richard Deeming16-Sep-15 2:29
mveRichard Deeming16-Sep-15 2:29 
GeneralRe: Declarations using var Pin
Eddy Vluggen16-Sep-15 9:32
professionalEddy Vluggen16-Sep-15 9:32 
GeneralRe: Declarations using var Pin
PIEBALDconsult16-Sep-15 11:53
mvePIEBALDconsult16-Sep-15 11:53 
AnswerRe: Declarations using var Pin
PIEBALDconsult16-Sep-15 11:52
mvePIEBALDconsult16-Sep-15 11:52 
GeneralRe: Declarations using var Pin
Rob Philpott16-Sep-15 23:05
Rob Philpott16-Sep-15 23:05 
GeneralRe: Declarations using var Pin
Richard Deeming17-Sep-15 1:53
mveRichard Deeming17-Sep-15 1:53 
AnswerRe: Declarations using var Pin
JBHowl17-Sep-15 2:15
JBHowl17-Sep-15 2:15 
GeneralRe: Declarations using var Pin
Pete O'Hanlon17-Sep-15 2:17
mvePete O'Hanlon17-Sep-15 2:17 
QuestionHow to declare and define a method returns a list? Pin
Member 1198763615-Sep-15 21:36
Member 1198763615-Sep-15 21:36 
AnswerRe: How to declare and define a method returns a list? Pin
OriginalGriff15-Sep-15 22:15
mveOriginalGriff15-Sep-15 22:15 
AnswerRe: How to declare and define a method returns a list? Pin
BillWoodruff16-Sep-15 8:01
professionalBillWoodruff16-Sep-15 8:01 
I suggest you get a good introductory book on C# and review the "basics." ".NET Book Zero," by Charles Petzold, is an excellent resource; it's free, and available on-line to download here: [^].

The code you show will not compile, and even your description of what the 'Employee class should be is not what it is, now. The rest of the code contains what appear to be "fragments."

You need to divide your task into specific steps, and test your work as you complete each step. Creating a method that returns a list is simple:
C#
public List<Employee> GetEmployeesByDivision(int divisionid, List<Employee> allemployees)
{
    List<Employee> empByDiv = new List<Employee>();

    foreach(var employee in allemployees)
    {
        if(employee.div_Id == divisionid) empByDiv.Add(employeed);
    }
    
    return empByDiv;
}
And, it's even easier to do using Linq, but that's for the future.
«I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can't see from the center» Kurt Vonnegut.

QuestionUSB port Pin
Member 1198669115-Sep-15 20:38
Member 1198669115-Sep-15 20:38 
AnswerRe: USB port Pin
Pete O'Hanlon15-Sep-15 21:29
mvePete O'Hanlon15-Sep-15 21:29 
GeneralRe: USB port Pin
Member 1198669116-Sep-15 15:51
Member 1198669116-Sep-15 15:51 
GeneralRe: USB port Pin
Pete O'Hanlon16-Sep-15 21:09
mvePete O'Hanlon16-Sep-15 21:09 
AnswerRe: USB port Pin
OriginalGriff15-Sep-15 21:39
mveOriginalGriff15-Sep-15 21:39 
GeneralRe: USB port Pin
Member 1198669116-Sep-15 15:54
Member 1198669116-Sep-15 15:54 
AnswerRe: USB port Pin
Eddy Vluggen17-Sep-15 22:54
professionalEddy Vluggen17-Sep-15 22:54 
QuestionDynamicly created ErrorProvider and garbage collection Pin
TMattC14-Sep-15 20:37
TMattC14-Sep-15 20:37 
AnswerRe: Dynamicly created ErrorProvider and garbage collection Pin
Eddy Vluggen14-Sep-15 23:36
professionalEddy Vluggen14-Sep-15 23:36 
QuestionRe-Get and Set Property Pin
Member 1116162514-Sep-15 20:02
Member 1116162514-Sep-15 20:02 
AnswerRe: Get and Set Property Pin
Peter Leow14-Sep-15 20:27
professionalPeter Leow14-Sep-15 20:27 
AnswerRe: Get and Set Property Pin
OriginalGriff14-Sep-15 21:40
mveOriginalGriff14-Sep-15 21:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.