Click here to Skip to main content
15,886,199 members
Home / Discussions / C#
   

C#

 
AnswerRe: session & cookie Pin
The Man from U.N.C.L.E.11-Nov-09 7:29
The Man from U.N.C.L.E.11-Nov-09 7:29 
GeneralRe: session & cookie Pin
Arefeh Haghpnah12-Nov-09 21:25
Arefeh Haghpnah12-Nov-09 21:25 
QuestionRestore main window from other process Pin
Daniel Leykauf11-Nov-09 6:14
Daniel Leykauf11-Nov-09 6:14 
AnswerRe: Restore main window from other process Pin
Paulo Zemek11-Nov-09 6:59
mvaPaulo Zemek11-Nov-09 6:59 
GeneralRe: Restore main window from other process Pin
Daniel Leykauf11-Nov-09 7:10
Daniel Leykauf11-Nov-09 7:10 
Question[Message Deleted] Pin
Crapaw4511-Nov-09 5:49
Crapaw4511-Nov-09 5:49 
QuestionActive UICulture in setup rpoject Pin
waelmail10511-Nov-09 5:19
waelmail10511-Nov-09 5:19 
Questioncan't get depth chart to display Pin
rooster215411-Nov-09 4:47
rooster215411-Nov-09 4:47 
I'm having trouble implementing a depth chart for my football simulator program. The way my program is structured, I have a Player class, a Team class, and a League class--the core classes. The depthchart would group players by their position and, by each position, sort by OVR (integer) in descending order (but only if their injury status is "false"--governed by a CanPlay method in my Player class; otherwise, they are not eligible for the depthchart). Position is a PlayerPosition type and PlayerPosition is enumerated as such:
[code]

public enum PlayerPosition { QB, HB, WR, TE, LT, LG, C, RG, RT, DE, DT, OLB, MLB, CB, FS, SS }

[/code]
This is in my Team class:
[code]

public List<Player> depthChart { get; set; }
public List<Player>[] DepthChart
{
    get
    {
        var result = new List<Player>[Enum.GetValues(typeof(PlayerPosition)).Length];
        foreach (PlayerPosition pos in Enum.GetValues(typeof(PlayerPosition)))
        {
            result[(int)pos] = this.Players.Where(pl => pl.position == pos && pl.CanPlay).OrderByDescending(pl => pl.OVR).ToList();
        }
        return result;
    }

[/code]
These are in my Main() method: two attempts to obtain information from the depth chart.

Method 1:
[code]

Team t = league.Teams[0];
var depthChart = t.DepthChart;
Console.WriteLine(depthChart);

[/code]

Method 2:
[code]

foreach (PlayerPosition pos in Enum.GetValues(typeof(PlayerPosition)))
{
    Console.Write(pos.ToString() + ':');
    depthChart[(int)pos].ForEach(p => Console.Write(' ' + p.lastName));
    Console.WriteLine();
}

[/code]

For method 1, I get on the console readout: System.Collections.Generic.List`1[FranchiseSim.Player][]
For method 2, I get on the console readout only the proper position strings (like QB, RB, etc.) and the colon (Smile | :) but nothing from the depth chart.
AnswerRe: can't get depth chart to display Pin
Keith Barrow11-Nov-09 6:24
professionalKeith Barrow11-Nov-09 6:24 
GeneralRe: can't get depth chart to display Pin
rooster215411-Nov-09 9:37
rooster215411-Nov-09 9:37 
GeneralRe: can't get depth chart to display Pin
Keith Barrow11-Nov-09 13:28
professionalKeith Barrow11-Nov-09 13:28 
QuestionHow to resize two texbox proportionally? Pin
Zeokat11-Nov-09 1:21
Zeokat11-Nov-09 1:21 
AnswerRe: How to resize two texbox proportionally? Pin
Lyon Sun11-Nov-09 2:12
Lyon Sun11-Nov-09 2:12 
GeneralRe: How to resize two texbox proportionally? Pin
Zeokat11-Nov-09 10:04
Zeokat11-Nov-09 10:04 
GeneralRe: How to resize two texbox proportionally? Pin
Zeokat12-Nov-09 0:10
Zeokat12-Nov-09 0:10 
Questionhow to perform image erosion in c#? Pin
Rubasini11-Nov-09 1:04
Rubasini11-Nov-09 1:04 
Questionhow to build remote system call application ? Pin
sudhir behera11-Nov-09 0:24
sudhir behera11-Nov-09 0:24 
AnswerRe: how to build remote system call application ? Pin
Abhishek Sur11-Nov-09 0:45
professionalAbhishek Sur11-Nov-09 0:45 
QuestionCreate radio buttons using data from XML Pin
Zar Ni10-Nov-09 22:59
Zar Ni10-Nov-09 22:59 
AnswerRe: Create radio buttons using data from XML Pin
Calla10-Nov-09 23:31
Calla10-Nov-09 23:31 
QuestionTableLayoutPanel Problem Pin
Tim Daughton10-Nov-09 22:32
Tim Daughton10-Nov-09 22:32 
AnswerMessage Closed Pin
10-Nov-09 22:38
stancrm10-Nov-09 22:38 
GeneralRe: TableLayoutPanel Problem Pin
Tim Daughton10-Nov-09 22:59
Tim Daughton10-Nov-09 22:59 
Questionupdating multiple rows of a single column with different values at runtime from C# Pin
Member 236780010-Nov-09 22:18
Member 236780010-Nov-09 22:18 
AnswerRe: updating multiple rows of a single column with different values at runtime from C# Pin
MumbleB11-Nov-09 0:24
MumbleB11-Nov-09 0:24 

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.