Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User group tidbits 1

Status
Not open for further replies.

chiph

Programmer
Jun 9, 1999
9,878
US
I went to the Triangle .NET user group meeting last night ( where the speaker was Brian Harry - formerly of DaVinchi software and One Tree Software (they initially wrote Source Safe, and sold it to MS for a couple of million).

Here's a few interesting things about the CLR:
[ol][li]The CLR supports creating arrays with lower bounds (dimensioning arrays to start somewhere other than zero), but none of the languages support it[/li]
[li]Rectangular arrays are much more memory efficient than jagged arrays. But a little slower - MS will address this in the next release.[/li]
[li]Use PEVerify after building to check for buffer overruns, common errors, etc.[/li]
[li]NGen image won't be used if the policies (permissions) have been changed, or a Windows service pack, or other "environment" change has occurred -- it will run the (slower) JIT version instead. After making those sorts of changes you have to re-NGen on the target machine[/li]
[li]NGen loads about 40% faster (no JIT needed), but consumes more memory.[/li]
[li]Future versions of the framework may use Palladium digital rights management to protect the intellectual property in your assemblies. No obfusticator required - the OS will deny access to the (encrypted) MSIL.[/li]
[li]Minimum size of an object is 12 bytes. It will be much greater if you have any virtual methods, or if you use the default implementation of GetHashCode, or your object participates in COM interop.[/li]
[li]Don't trust the default implementation of GetHashCode. You will get different values if your object is persisted, or remoted. Note that classes like String override the default implementation, and do generate repeatable hash values.[/li]
[li]In v1.1, you can enable customer debug probes in your builds. These will check for common programming mistakes (freeing a delegate reference too soon, etc) and alert you via a message.[/li]
[li]StringBuilder objects become immutable after calling ToString on them. If you then attempt to concatenate more string info onto them, a copy of the (now)String is made into fresh memory. This "lazy copy" is a performance improvement, as most programs do: concat..concat..concat..ToString and then throw the StringBuilder away.[/li]
[/ol]

Chip H.
 
Sorry to be a pedant but, look up the array class CreateInstance method, in the visual studio documentation.

It allows you to set the lower bounds of an array. The CLR is optimized for arrays with a lowerbound of zero, but if you are not worried about performance it is posssible to create arrays with of lower bound <> 0.

Sorry
 
Yes, the framework supports starting arrays somewhere other than zero (System.Array), but the C# language itself does not. See:
ms-help://MS.VSCC/MS.MSDNVS/csref/html/vclrfArraysPG.htm

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top