The uncommon features of C#.(blog.dotnetclr.com)

submitted by rawsoftrawsoft(430) 4 years, 6 months ago

A quick and dirty post about the few keywords & statements that developers rarely use.

3 comments |category: |Views: 5

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

posted by yesthatmcgurkyesthatmcgurk(4063) 4 years, 6 months ago 0

Const is inlined by the compiler and therefore must be set before compilation. Readonly can be set at runtime at instantiation.

I would think volatile can be used with a value type as it signifies that the value of the variable should not be placed in a register. It can be used instead of a lock construct, however they are not equivalent. I wouldn't trust a volatile when strict control over a shared variable is needed in a multithreaded app.

Would you ever need to use the fixed construct in a safe context? Its pretty much always used when p/invoking, which is not "safe".

Can't use a yield in an anonymous method... probably has something to do with the yield statement needing a strong rooting. Somebody whose IL is strong can answer that one.

Non question comments:

Indexers are pure joy. Never create a custom collection without one.

Richter says that you should always surround your arithmetic with checked and unchecked in order to communicate your overflow-checking intent to others who may read your code; I can't find much wrong with that.

If you create a DLL, you use (or should use!) internal to mark those classes and methods that users of your assembly should not access.

If you name a class in such a way that it masks a namespace, then you don't need the :: operator; you need a smack in the friggen head.

Reply

posted by jessejesse(100) 4 years, 6 months ago 0

Wild, the page loads and eats my CPU, locking IE7 up tight. FF2, no problem.

Reply

posted by phaymanphayman(3550) 4 years, 6 months ago 0

Love the :: alias feature

Reply

information Login or create an account to comment on this story