John Lam 1997 — 2026

RubyCLR is all about choice

Look at what I got working this morning:

def test_enumerator
  a = ArrayList.new
  a.Add(1)
  a.Add(2)
  a.Add(3)
  e = a.get_interface(IEnumerable).GetEnumerator.get_interface(IEnumerator)
  assert e.MoveNext
  assert 1, e.Current
  assert e.MoveNext
  assert 2, e.Current
  assert e.MoveNext
  assert 3, e.Current
  assert !e.MoveNext
end

vs.

def test_enumerator
  a = ArrayList.new
  a.add(1)
  a.add(2)
  a.add(3)
  e = a.get_interface(IEnumerable).get_enumerator.get_interface(IEnumerator)
  assert e.move_next
  assert 1, e.current
  assert e.move_next
  assert 2, e.current
  assert e.move_next
  assert 3, e.current
  assert !e.move_next
end

By the way, both work in the same app.

5 archived reader comments

Justin (2006-02-23)

Is it me or do those look exactly the same?

Justin (2006-02-23)

Oh, and sorry to go off topic - but did you see my comment #9 in your previous post about the second drop of the clr (http://www.iunknown.com/articles/2006/02/20/second-drop-of-rubyclr#comments)?

Basically, I’d really like to know if its possible to override a method on all Controls (for example, Text= and Text) or if I have to override each control individually.

Thibaut (2006-02-23)

They don’t look the same: you can use both ruby_casing and DotNetCasing on the same dotnet object.

(I deserve my beer!)

John Lam (2006-02-23)

Justin - that’s a really interesting question. If I actually used inheritance to generate my shims then it would be possible to do that override in a single place. But I don’t - now. I’ll have to think about it some more to see if I could change my shadow classes to derive from one another … it would certainly trim memory usage considerably … hmmm …

Justin (2006-02-23)

Ohhh I see! Awesome. This will really help with a special type of property initialization I want to do …