Browse by Tags

All Tags » Wacky Ideas (RSS)

Coding in the style of Glee

As previously mentioned , at CodeMash 2012 I gave a very silly Pecha Kucha talk entitled "Coding in the style of Glee". The video is on YouTube , or can be seen embedded below: (There's also another YouTube video from a different angle....
Posted by skeet | with no comments

Eduasync part 13: first look at coroutines with async

(This part covers project 18 in the source code .) As I mentioned in earlier parts, the "awaiting" part of async methods is in no way limited to tasks. So long as we have a suitable GetAwaiter() method which returns a value of a type which in...
Posted by skeet | 14 comment(s)
Filed under: , , , ,

Of memory and strings

This post was provoked by a recent Stack Overflow question which asked whether there was an efficient representation of ASCII strings in .NET. In particular, the questioner wanted to story hundreds of thousands - possibly millions - of strings in memory...
Posted by skeet | 32 comment(s)
Filed under: , ,

A Model/View to a Kill (Naked came the null delegate, part 5)

(I suggest you read the earlier parts of the story first. I'm not claiming it'll make any more sense afterwards, mind you.) Even though Seymour Sharpton's brain was in a spinlock, a low-level interrupt brought him out of his stupor - namely...
Posted by skeet | 4 comment(s)
Filed under: ,

The curious case of the publicity-seeking interface and the shy abstract class

Noda Time has a guilty secret, and I'm not just talking about the fact that there's been very little progress on it recently. (It's not dead as a project - I have high hopes, when I can put some quality time into it.) This secret is called...
Posted by skeet | 26 comment(s)
Filed under: , ,

Non-iterable collection initializers

Yesterday on Stack Overflow, I mentioned that sometimes I make a type implement IEnumerable just so that I can use collection initializers with it. In such a situation, I use explicit interface implementation (despite not really needing to - I'm not...
Posted by skeet | 15 comment(s)
Filed under: ,

Code and data

In a recent Stack Overflow question, I answered a question which started off with a broken XPath expression by suggesting that that poster might be better off using LINQ to XML instead. The discussion which followed in the comments (around whether or...
Posted by skeet | 12 comment(s)
Filed under: ,

Iterate, damn you!

Do you know the hardest thing about presenting code with surprising results? It's hard to do so without effectively inviting readers to look for the trick. Not that that's always enough - I failed the last of Neal and Eric's C# puzzlers at...
Posted by skeet | 15 comment(s)
Filed under: ,

First encounters with Reactive Extensions

I've been researching Reactive Extensions for the last few days, with an eye to writing a short section in chapter 12 of the second edition of C# in Depth. (This is the most radically changed chapter from the first edition; it will be covering LINQ...
Posted by skeet | 15 comment(s)
Filed under: , , ,

"Magic" null argument testing

Warning: here be dragons. I don't think this is the right way to check for null arguments, but it was an intriguing idea. Today on Stack Overflow, I answered a question about checking null arguments . The questioner was already using an extension...

Contract classes and nested types within interfaces

I've just been going through some feedback for the draft copy of the second edition of C# in Depth. In the contracts section, I have an example like this: [ContractClass( typeof (ICaseConverterContracts))] public   interface ICaseConverter {...
Posted by skeet | 9 comment(s)
Filed under: , , ,

Iterating atomically

The IEnumerable<T> and IEnumerator<T> interfaces in .NET are interesting. They crop up an awful lot, but hardly anyone ever calls them directly - you almost always use a foreach loop to iterate over the collection. That hides all the calls...

An object lesson in blogging and accuracy; was: Efficient "vote counting" with LINQ to Objects - and the value of nothing

Well, this is embarrassing. Yesterday evening, I excitedly wrote a blog post about an interesting little idea for making a particular type of LINQ query (basically vote counting) efficient. It was an idea that had occurred to me a few months back, but...
Posted by skeet | 11 comment(s)
Filed under: , ,

Generic constraints for enums and delegates

As most readers probably know, C# prohibits generic type constraints from referring to System.Object, System.Enum, System.Array, System.Delegate and System.ValueType. In other words, this method declaration is illegal: public   static T[] GetValues<T>...
Posted by skeet | 56 comment(s)

The "dream book" for C# and .NET

This morning I showed my hand a little on Twitter . I've had a dream for a long time about the ultimate C# book. It's a dream based on Effective Java , which is my favourite Java book, along with my experiences of writing C# in Depth. Effective...
Posted by skeet | 34 comment(s)
Filed under: , ,

Faking COM to fool the C# compiler

C# 4 has some great features to make programming against COM components bearable fun and exciting. In particular: PIA linking allows you to embed just the relevant bits of the Primary Interop Assembly into your own assembly, so the PIA isn't actually...
Posted by skeet | 1 comment(s)

A different approach to inappropriate defaults

I've had a couple of bug reports about my Protocol Buffers port - both nicely detailed, and one including a patch to fix it. (It's only due to my lack of timeliness in actually submitting the change that the second bug report occurred. Oops.)...
Posted by skeet | 9 comment(s)
Filed under: , ,

Go on, ask me anything

This afternoon, I found a comment which had been trapped in the spam bin for this blog. It was from Andrew Rimmer, in reply to my "micro-celebrity" post , pointing me at http://askjonskeet.com The world has officially become extremely silly...
Posted by skeet | 29 comment(s)

Breaking Liskov

Very recently, Barbara Liskov won the Turing award , which makes it a highly appropriate time to ponder when it's reasonable to ignore her most famous piece of work, the Liskov Substitution (or Substitutability) Principle . This is not idle speculation...
Posted by skeet | 32 comment(s)
Filed under: , ,

RFID: What I really want it for

This isn't really coding related, but it's technology related at least. There's been a lot of fuss made about how great or awful RFID is and will be in the future, in terms of usefuless and privacy invasion respectively. There's one use...
Posted by skeet | 9 comment(s)
Filed under: ,
More Posts Next page »