> AFAIK you don't create more objects. Is exactly the same, the difference
> is that instead of making thousands of calls to GetEncoding , and going
> several times through the switch statement, you just do it once... We
> didn't detect a hit on memory consumption (I will double check), but
> peformance hit is great!

I'm not sure about the CF, but in the normal framework, once you create an
Encoding object, it is cached in a hashtable anyway (that's what it does
looking at Encoding.GetEncoding in Reflector). So every call to
Encoding.GetEncoding with the same codepage will get the exact same instance
anyway.

So, at least for the normal framework, doing it once in the constructor is
the same as doing it each time it is used (in terms of the behavior).

Dean.




-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Firebird-net-provider mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to