Click here to Skip to main content
15,892,809 members
Home / Discussions / C#
   

C#

 
QuestionSQLite datatime Pin
jashimu11-Nov-09 10:23
jashimu11-Nov-09 10:23 
AnswerRe: SQLite datatime Pin
Christian Graus11-Nov-09 11:19
protectorChristian Graus11-Nov-09 11:19 
GeneralRe: SQLite datatime Pin
jashimu12-Nov-09 4:22
jashimu12-Nov-09 4:22 
AnswerRe: SQLite datatime Pin
curtmayers21-Apr-10 8:38
curtmayers21-Apr-10 8:38 
Questionhelp on SAPI interfaces Pin
Xelalem11-Nov-09 7:51
Xelalem11-Nov-09 7:51 
QuestionWireless Network Pin
codefinder0911-Nov-09 7:43
codefinder0911-Nov-09 7:43 
AnswerRe: Wireless Network Pin
EliottA11-Nov-09 8:41
EliottA11-Nov-09 8:41 
Questionsplit event handler or fire event as two events Pin
Mr.Kode11-Nov-09 7:34
Mr.Kode11-Nov-09 7:34 
AnswerRe: split event handler or fire event as two events Pin
The Man from U.N.C.L.E.11-Nov-09 7:50
The Man from U.N.C.L.E.11-Nov-09 7:50 
AnswerRe: split event handler or fire event as two events Pin
PIEBALDconsult11-Nov-09 9:29
mvePIEBALDconsult11-Nov-09 9:29 
Questionsession & cookie Pin
Arefeh Haghpnah11-Nov-09 7:09
Arefeh Haghpnah11-Nov-09 7:09 
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 

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.