Click here to Skip to main content
15,904,655 members
Home / Discussions / C#
   

C#

 
GeneralRe: not working input simulator Pin
Sascha Lefèvre1-Apr-16 6:09
professionalSascha Lefèvre1-Apr-16 6:09 
GeneralRe: not working input simulator Pin
Jonahweird1-Apr-16 6:16
Jonahweird1-Apr-16 6:16 
GeneralRe: not working input simulator Pin
Sascha Lefèvre1-Apr-16 6:20
professionalSascha Lefèvre1-Apr-16 6:20 
GeneralRe: not working input simulator Pin
Jonahweird2-Apr-16 1:35
Jonahweird2-Apr-16 1:35 
QuestionTcpListener don't send FIN after client send FIN Pin
Aurélien381-Apr-16 3:13
Aurélien381-Apr-16 3:13 
AnswerRe: TcpListener don't send FIN after client send FIN Pin
Richard Andrew x641-Apr-16 3:40
professionalRichard Andrew x641-Apr-16 3:40 
GeneralRe: TcpListener don't send FIN after client send FIN Pin
Aurélien381-Apr-16 10:46
Aurélien381-Apr-16 10:46 
AnswerRe: TcpListener don't send FIN after client send FIN Pin
Gerry Schmitz1-Apr-16 7:02
mveGerry Schmitz1-Apr-16 7:02 
GeneralRe: TcpListener don't send FIN after client send FIN Pin
Aurélien381-Apr-16 10:38
Aurélien381-Apr-16 10:38 
QuestionMulti threading with datatable in C# Pin
Jaimesh.24111-Apr-16 3:03
Jaimesh.24111-Apr-16 3:03 
GeneralRepost Pin
Sascha Lefèvre1-Apr-16 3:39
professionalSascha Lefèvre1-Apr-16 3:39 
QuestionFont error when using C# code behind to export from crystal report to pdf Pin
botngot8331-Mar-16 21:55
botngot8331-Mar-16 21:55 
AnswerRe: Font error when using C# code behind to export from crystal report to pdf Pin
Eddy Vluggen1-Apr-16 1:36
professionalEddy Vluggen1-Apr-16 1:36 
GeneralRe: Font error when using C# code behind to export from crystal report to pdf Pin
botngot833-Apr-16 22:05
botngot833-Apr-16 22:05 
QuestionIssue around converting Expression<Func<T, bool>> to Expression<Func<U, bool>> Pin
RichardGrimmer31-Mar-16 3:36
RichardGrimmer31-Mar-16 3:36 
AnswerRe: Issue around converting Expression<Func<T, bool>> to Expression<Func<U, bool>> Pin
Richard Deeming31-Mar-16 4:59
mveRichard Deeming31-Mar-16 4:59 
GeneralRe: Issue around converting Expression<Func<T, bool>> to Expression<Func<U, bool>> Pin
Sascha Lefèvre31-Mar-16 5:21
professionalSascha Lefèvre31-Mar-16 5:21 
GeneralRe: Issue around converting Expression<Func<T, bool>> to Expression<Func<U, bool>> Pin
Richard Deeming31-Mar-16 5:49
mveRichard Deeming31-Mar-16 5:49 
GeneralRe: Issue around converting Expression<Func<T, bool>> to Expression<Func<U, bool>> Pin
Sascha Lefèvre31-Mar-16 6:41
professionalSascha Lefèvre31-Mar-16 6:41 
QuestionUsing Deployment Item with Directory.GetFiles Pin
RamboSp31-Mar-16 2:17
RamboSp31-Mar-16 2:17 
AnswerRe: Using Deployment Item with Directory.GetFiles Pin
Eddy Vluggen1-Apr-16 1:33
professionalEddy Vluggen1-Apr-16 1:33 
Questioncurrent state of old issue of Enum boxing when used as Keys in a Dictionary ? Pin
BillWoodruff31-Mar-16 2:15
professionalBillWoodruff31-Mar-16 2:15 
AnswerRe: current state of old issue of Enum boxing when used as Keys in a Dictionary ? Pin
Richard Deeming31-Mar-16 2:52
mveRichard Deeming31-Mar-16 2:52 
Looking at the source of the EqualityComparer<T> class[^], there's special-case code to handle enums where the underlying type is Byte, SByte, Int16, UInt16, Int32, UInt32, Int64 or UInt64:
C#
if (t.IsEnum) {
    TypeCode underlyingTypeCode = Type.GetTypeCode(Enum.GetUnderlyingType(t));

    // Depending on the enum type, we need to special case the comparers so that we avoid boxing
    // Note: We have different comparers for Short and SByte because for those types we need to make sure we call GetHashCode on the actual underlying type as the 
    // implementation of GetHashCode is more complex than for the other types.
    switch (underlyingTypeCode) {
        case TypeCode.Int16: // short
            return (EqualityComparer<T>)RuntimeTypeHandle.CreateInstanceForAnotherGenericParameter((RuntimeType)typeof(ShortEnumEqualityComparer<short>), t);
        case TypeCode.SByte:
            return (EqualityComparer<T>)RuntimeTypeHandle.CreateInstanceForAnotherGenericParameter((RuntimeType)typeof(SByteEnumEqualityComparer<sbyte>), t);
        case TypeCode.Int32:
        case TypeCode.UInt32:
        case TypeCode.Byte:
        case TypeCode.UInt16: //ushort
            return (EqualityComparer<T>)RuntimeTypeHandle.CreateInstanceForAnotherGenericParameter((RuntimeType)typeof(EnumEqualityComparer<int>), t);
        case TypeCode.Int64:
        case TypeCode.UInt64:
            return (EqualityComparer<T>)RuntimeTypeHandle.CreateInstanceForAnotherGenericParameter((RuntimeType)typeof(LongEnumEqualityComparer<long>), t);
    }
}

The presence of the [Flags] attribute won't make any difference.

Obviously, this is the latest version of the BCL. I'm not sure how far back this was added.



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


QuestionMessage Removed Pin
31-Mar-16 0:25
PomegranateTiger31-Mar-16 0:25 
QuestionSync SQLite with Oracle or Postgre Pin
Potestas30-Mar-16 21:42
Potestas30-Mar-16 21:42 

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.