Click here to Skip to main content
15,898,035 members
Home / Discussions / C#
   

C#

 
GeneralRe: how can i create textBox in C# with email autocomplate exactly like "outlook To field" Pin
A7mad_17-Feb-12 23:32
A7mad_17-Feb-12 23:32 
AnswerRe: how can i create textBox in C# with email autocomplate exactly like "outlook To field" Pin
Shameel14-Feb-12 2:26
professionalShameel14-Feb-12 2:26 
QuestionListbox in user control is hiding in the tablelayoutpanel control Pin
Ravi Rangari14-Feb-12 1:29
Ravi Rangari14-Feb-12 1:29 
AnswerRe: Listbox in user control is hiding in the tablelayoutpanel control Pin
GParkings14-Feb-12 2:05
GParkings14-Feb-12 2:05 
GeneralRe: Listbox in user control is hiding in the tablelayoutpanel control Pin
Ravi Rangari14-Feb-12 16:33
Ravi Rangari14-Feb-12 16:33 
GeneralRe: Listbox in user control is hiding in the tablelayoutpanel control Pin
GParkings14-Feb-12 23:52
GParkings14-Feb-12 23:52 
GeneralRe: Listbox in user control is hiding in the tablelayoutpanel control Pin
Ravi Rangari16-Feb-12 0:11
Ravi Rangari16-Feb-12 0:11 
QuestionGetHashCode override for a value wrapper. Is mutable ok? Pin
GParkings13-Feb-12 23:32
GParkings13-Feb-12 23:32 
Hi all,

I am in the process of coding a generic wrapper class that adds some metadata and functionality to a generic value (unconstrained). I would prefer the equality of this wrapper to simply pass through to the underlying value.

As a result the equals and getHashCode overrides are as follows

C#
public override bool Equals(object obj)
{
    return _value.Equals(obj);
}

public override int GetHshCode()
{
    return _value.GetHashCode();
}


My concern here is that, as _value is not read-only, we now have a hash code that could potentially change.

Am i right to be concerned about this with regard to housing the class within collections or using it within LINQ statements? (IIRC they make use of hashtables behind the scenes)

Is there a better/safer approach?

Thanks in advance
Pedis ex oris
Quidquid latine dictum sit, altum sonatur

AnswerRe: GetHashCode override for a value wrapper. Is mutable ok? Pin
BobJanova14-Feb-12 0:42
BobJanova14-Feb-12 0:42 
GeneralRe: GetHashCode override for a value wrapper. Is mutable ok? Pin
GParkings14-Feb-12 0:48
GParkings14-Feb-12 0:48 
GeneralRe: GetHashCode override for a value wrapper. Is mutable ok? Pin
Daniel Grunwald15-Feb-12 0:37
Daniel Grunwald15-Feb-12 0:37 
AnswerRe: GetHashCode override for a value wrapper. Is mutable ok? Pin
PIEBALDconsult14-Feb-12 2:47
mvePIEBALDconsult14-Feb-12 2:47 
GeneralRe: GetHashCode override for a value wrapper. Is mutable ok? Pin
GParkings14-Feb-12 2:56
GParkings14-Feb-12 2:56 
QuestionRaysharp Client SDK Pin
jayesh86.pkd13-Feb-12 22:49
jayesh86.pkd13-Feb-12 22:49 
AnswerRe: Raysharp Client SDK Pin
Dave Kreskowiak14-Feb-12 2:08
mveDave Kreskowiak14-Feb-12 2:08 
GeneralRe: Raysharp Client SDK Pin
jayesh86.pkd14-Feb-12 21:55
jayesh86.pkd14-Feb-12 21:55 
QuestionVisual C# dictionary Pin
csshtml13-Feb-12 22:07
csshtml13-Feb-12 22:07 
AnswerRe: Visual C# dictionary Pin
V.14-Feb-12 0:44
professionalV.14-Feb-12 0:44 
AnswerRe: Visual C# dictionary Pin
Eddy Vluggen14-Feb-12 5:06
professionalEddy Vluggen14-Feb-12 5:06 
AnswerRe: Visual C# dictionary Pin
PIEBALDconsult14-Feb-12 5:12
mvePIEBALDconsult14-Feb-12 5:12 
GeneralRe: Visual C# dictionary Pin
csshtml14-Feb-12 6:34
csshtml14-Feb-12 6:34 
QuestionFolder lock Pin
aniperiye13-Feb-12 19:59
aniperiye13-Feb-12 19:59 
AnswerRe: Folder lock Pin
lukeer13-Feb-12 20:49
lukeer13-Feb-12 20:49 
QuestionC sharp windows service Pin
candogu13-Feb-12 19:53
candogu13-Feb-12 19:53 
AnswerRe: C sharp windows service Pin
V.13-Feb-12 20:55
professionalV.13-Feb-12 20:55 

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.