Avoid those unnecessary for-loops…
April 4th, 2008One thing that makes my - and others - code look ugly are all those for-loops repeatedly embedded into the code.
A typical example ias converting a string of comma seperated numbers into an array of integers. Here’s how to do it in one statement, without any loop:
Dim str As String = "1,2,3,4,5"
Dim ints As Integer() = Array.ConvertAll(Of String, Integer)(str.Split(","), _
AddressOf Convert.ToInt32)
- petter
How can I access a protected member from a derived class?
April 1st, 2008First I encountered the error message:
Compiler Error CS1540: Cannot access protected member 'member' via a qualifier of type 'type1'; the qualifier must be of type 'type2' (or derived from it).
Then I encountered Eric Lipperts explanation of Why Can’t I Access A Protected Member From A Derived Class?
Then I got angry. Read the rest of this entry »












