Click here to Skip to main content
15,845,330 members
Home / Discussions / C#
   

C#

 
GeneralRe: StreamReader in TcpListener Pin
Member 114922552-Mar-15 9:25
Member 114922552-Mar-15 9:25 
QuestionDatagridview row replay Pin
sdfsdfsdfewrew3feff1-Mar-15 6:03
sdfsdfsdfewrew3feff1-Mar-15 6:03 
GeneralRe: Datagridview row replay Pin
Richard MacCutchan1-Mar-15 7:15
mveRichard MacCutchan1-Mar-15 7:15 
GeneralRe: Datagridview row replay Pin
sdfsdfsdfewrew3feff1-Mar-15 9:23
sdfsdfsdfewrew3feff1-Mar-15 9:23 
GeneralRe: Datagridview row replay Pin
Richard MacCutchan1-Mar-15 23:38
mveRichard MacCutchan1-Mar-15 23:38 
GeneralRe: Datagridview row replay Pin
Eddy Vluggen2-Mar-15 9:02
professionalEddy Vluggen2-Mar-15 9:02 
Questioncreating a generic factory class that handles ValueTypes ? Pin
BillWoodruff1-Mar-15 0:36
professionalBillWoodruff1-Mar-15 0:36 
AnswerRe: creating a generic factory class that handles ValueTypes ? Pin
OriginalGriff1-Mar-15 1:11
mveOriginalGriff1-Mar-15 1:11 
You can constrain it to a value type by making the whole class generic and adding the struct constraint:
C#
public class VTBunchOLists<T> : List<IEnumerable<T>> where T : struct
    {
    private bool isInt;

    // 'ctor
    public VTBunchOLists()
        {
        isInt = typeof(T) == typeof(Int32);
        }
    ...
    }
(You have to use struct because ValueType isn't the root type for value types - it's just used for boxing)
And that might help a little - you can't use a where constraint on any sealed class (and all the primitives are sealed IIRC)

I have to say I don't like runtime type rejection in the constructor: I know what you mean, but it goes against my grain somewhat to force a run time error for something that should be a compile time problem! Laugh | :laugh:
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

GeneralRe: creating a generic factory class that handles ValueTypes ? Pin
BillWoodruff1-Mar-15 2:23
professionalBillWoodruff1-Mar-15 2:23 
AnswerRe: creating a generic factory class that handles ValueTypes ? Pin
manchanx1-Mar-15 2:53
professionalmanchanx1-Mar-15 2:53 
GeneralRe: creating a generic factory class that handles ValueTypes ? Pin
BillWoodruff1-Mar-15 7:26
professionalBillWoodruff1-Mar-15 7:26 
AnswerRe: creating a generic factory class that handles ValueTypes ? Pin
Richard Deeming2-Mar-15 3:24
mveRichard Deeming2-Mar-15 3:24 
QuestionIs there a way to make "speakers" pickup 440hz? Pin
Member 1148826328-Feb-15 19:13
Member 1148826328-Feb-15 19:13 
AnswerRe: Is there a way to make "speakers" pickup 440hz? Pin
OriginalGriff28-Feb-15 21:05
mveOriginalGriff28-Feb-15 21:05 
AnswerRe: Is there a way to make "speakers" pickup 440hz? Pin
Frankie-C1-Mar-15 2:21
Frankie-C1-Mar-15 2:21 
AnswerRe: Is there a way to make "speakers" pickup 440hz? Pin
GrooverFromHolland1-Mar-15 2:25
GrooverFromHolland1-Mar-15 2:25 
QuestionIs there Any Way to Set the Namespace of a Web Service in Configuration instead of Code? Pin
jojoba2027-Feb-15 23:52
jojoba2027-Feb-15 23:52 
AnswerRe: Is there Any Way to Set the Namespace of a Web Service in Configuration instead of Code? Pin
Dave Kreskowiak28-Feb-15 5:08
mveDave Kreskowiak28-Feb-15 5:08 
AnswerRe: Is there Any Way to Set the Namespace of a Web Service in Configuration instead of Code? Pin
jojoba2028-Feb-15 23:35
jojoba2028-Feb-15 23:35 
QuestionDataGridView Entry Disappears (C#) Pin
Member 1148588827-Feb-15 9:53
Member 1148588827-Feb-15 9:53 
AnswerRe: DataGridView Entry Disappears (C#) Pin
Dave Kreskowiak27-Feb-15 12:26
mveDave Kreskowiak27-Feb-15 12:26 
GeneralRe: DataGridView Entry Disappears (C#) Pin
Member 1148588827-Feb-15 13:08
Member 1148588827-Feb-15 13:08 
GeneralRe: DataGridView Entry Disappears (C#) Pin
Dave Kreskowiak27-Feb-15 14:16
mveDave Kreskowiak27-Feb-15 14:16 
GeneralRe: DataGridView Entry Disappears (C#) Pin
Member 114858881-Mar-15 12:32
Member 114858881-Mar-15 12:32 
GeneralRe: DataGridView Entry Disappears (C#) Pin
Dave Kreskowiak1-Mar-15 13:43
mveDave Kreskowiak1-Mar-15 13:43 

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.