<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Vb.net on Hans Kruse</title><link>https://hanskruse.eu/tags/vb.net/</link><description>Recent content in Vb.net on Hans Kruse</description><generator>Hugo</generator><language>en-GB</language><copyright>© Hans Kruse</copyright><lastBuildDate>Fri, 17 Aug 2018 03:31:19 -0700</lastBuildDate><atom:link href="https://hanskruse.eu/tags/vb.net/index.xml" rel="self" type="application/rss+xml"/><item><title>Fluent Programming, Fluent Properties</title><link>https://hanskruse.eu/post/2010-06-20-fluent-programming-fluent-properties/</link><pubDate>Sun, 20 Jun 2010 02:19:00 -0700</pubDate><guid>https://hanskruse.eu/post/2010-06-20-fluent-programming-fluent-properties/</guid><description>&lt;p&gt;Currently Fluent Programming is a hype. You see it in client-side web programming, you see it in .NET programming and I think it is safe to assume it has been, is or will be fashionable in other environments too. You find fluent interfaces within the .NET framework in the LINQ libraries.&lt;/p&gt;&#10;&lt;p&gt;The idea of fluent interfaces is that you structure your code in such a way that you can continue chaining methods on a line. In the example below we create a FluentPerson, and like in this sentence which is way too long and uses commas to chain, we continue, by setting the &lt;em&gt;Age&lt;/em&gt;, the &lt;em&gt;Name&lt;/em&gt;, let it &lt;em&gt;Dance&lt;/em&gt; and finally give it a &lt;em&gt;Rest&lt;/em&gt;.&lt;/p&gt;</description></item><item><title>Operator overloading</title><link>https://hanskruse.eu/post/2010-06-20-operator-overloading/</link><pubDate>Sun, 20 Jun 2010 02:17:00 -0700</pubDate><guid>https://hanskruse.eu/post/2010-06-20-operator-overloading/</guid><description>&lt;p&gt;Although I have been doing .NET since December 1999 I never followed a formal course or did take an exam. With my new employer I am going to be certified. For this I have to pass some basic exams first. These are not difficult but still require some study.&lt;/p&gt;&#10;&lt;p&gt;When reading chapter one of the course book I noticed something called widening and narrowing operator overloading. These two overloads allow you to create some custom type instance by assigning a simple type. This caught my attention because we use some custom types which are just some Guids wrapped in a type. The wrapping is done to distinguish their use.&lt;/p&gt;</description></item><item><title>Using Memoize in ASP.NET</title><link>https://hanskruse.eu/post/2010-06-20-using-memoize-in-aspnet/</link><pubDate>Sun, 20 Jun 2010 02:11:00 -0700</pubDate><guid>https://hanskruse.eu/post/2010-06-20-using-memoize-in-aspnet/</guid><description>&lt;p&gt;I spent quite some time blogging about memoize. Until now I did not have a good solution for Memoize in VB.NET because VB.NET&amp;rsquo;s lambda function is limited to a single expression and VB.NET has no anonymous delegates.&lt;/p&gt;&#10;&lt;p&gt;I first made a Memoize that used a Dictionary. Based on this implementation I made one that wraps the ASP.NET Cache. Certainly some generalisation is possible. I wrote a base class that abstracted away the concrete implementation of the cache using three functions:&lt;/p&gt;</description></item><item><title>Memento without lambdas</title><link>https://hanskruse.eu/post/2010-06-20-memoize-in-vbnet/</link><pubDate>Sun, 20 Jun 2010 02:08:00 -0700</pubDate><guid>https://hanskruse.eu/post/2010-06-20-memoize-in-vbnet/</guid><description>&lt;p&gt;I am pleased with the idea of a generalised Memoize Function. However my current implementation works from .NET 3.0 upwards because Lambda expressions are available from version 3.0. In .NET 2.0 there are no Lambda expressions. In C# lambda functions can be easily replaced with anonymous delegate implementations. In VB.NET there is no such thing as anonymous delegate implementations. That does not mean we cannot implement Memoize in VB.NET. We have to simulate what the compiler does when compiling lambda functions with closure. We make a class that has three things:&lt;/p&gt;</description></item><item><title>Memento VB.NET</title><link>https://hanskruse.eu/post/2010-06-20-memento-vbnet/</link><pubDate>Sun, 20 Jun 2010 02:04:00 -0700</pubDate><guid>https://hanskruse.eu/post/2010-06-20-memento-vbnet/</guid><description>&lt;p&gt;In the past blog entries I played with an imperative IEnumerable wrapped implementation of the sequence. The mathematical definition of the Fibonacci sequence is a recursive one. It is both compact and beautiful. However if you implement this literally in C# or VB.NET you will get a terribly slow program that may even crash due to stack overflow. An imperative implementation that calculates Fib(n) for any random n may be a bit faster but is still slow. The code would be less comprehensible.&lt;/p&gt;</description></item><item><title>Alternative Fibonacci implementation</title><link>https://hanskruse.eu/post/2010-06-20-alternative-fibonacci-implementation/</link><pubDate>Sun, 20 Jun 2010 02:03:00 -0700</pubDate><guid>https://hanskruse.eu/post/2010-06-20-alternative-fibonacci-implementation/</guid><description>&lt;p&gt;On Scott Hanselman&amp;rsquo;s blog there was another formula for Fibonacci that uses the golden ratio and some Mathemagic to calculate Fib(n). This formula is more useful if you want to calculate Fib(n) for a certain n and if you are not interested in the sequence. I used this formula in an alternative implementation of my FibEnumerable just to test for correctness.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-vb" data-lang="vb"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c"&gt;&amp;#39; Fibonacci.vb created with MonoDevelop&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c"&gt;&amp;#39; User: kruse at 14:10 22-1-2009&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c"&gt;&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c"&gt;&amp;#39; To change standard headers go to Edit-&amp;gt;Preferences-&amp;gt;Coding-&amp;gt;Standard Headers&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c"&gt;&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;Option Explicit On&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;Option Strict On&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;Imports&lt;/span&gt; &lt;span class="nn"&gt;System&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;Imports&lt;/span&gt; &lt;span class="nn"&gt;System.Collections&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;Imports&lt;/span&gt; &lt;span class="nn"&gt;System.Collections.Generic&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;Namespace&lt;/span&gt; &lt;span class="nn"&gt;EUNemopolis.Math&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;Public&lt;/span&gt; &lt;span class="k"&gt;Class&lt;/span&gt; &lt;span class="nc"&gt;FibEnumerable2&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;Inherits&lt;/span&gt; &lt;span class="n"&gt;IntegerEnumerable&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;Protected&lt;/span&gt; &lt;span class="k"&gt;Overrides&lt;/span&gt; &lt;span class="k"&gt;Function&lt;/span&gt; &lt;span class="nf"&gt;NewEnumerator&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="ow"&gt;as&lt;/span&gt; &lt;span class="n"&gt;IEnumerator&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;New&lt;/span&gt; &lt;span class="n"&gt;FibEnumerator&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;End&lt;/span&gt; &lt;span class="k"&gt;Function&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;Private&lt;/span&gt; &lt;span class="k"&gt;Class&lt;/span&gt; &lt;span class="nc"&gt;FibEnumerator&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;Inherits&lt;/span&gt; &lt;span class="n"&gt;IntegerEnumerable&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IntegerEnumerator&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;Private&lt;/span&gt; &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;MAXN&lt;/span&gt; &lt;span class="ow"&gt;As&lt;/span&gt; &lt;span class="kt"&gt;Integer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;45&lt;/span&gt; &lt;span class="c"&gt;&amp;#39;The maximum n for which Fib(n) fits in an integer&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;Private&lt;/span&gt; &lt;span class="n"&gt;_n&lt;/span&gt; &lt;span class="ow"&gt;As&lt;/span&gt; &lt;span class="kt"&gt;Integer&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;Private&lt;/span&gt; &lt;span class="k"&gt;Readonly&lt;/span&gt; &lt;span class="k"&gt;Shared&lt;/span&gt; &lt;span class="n"&gt;GoldenRation&lt;/span&gt; &lt;span class="ow"&gt;as&lt;/span&gt; &lt;span class="kt"&gt;Double&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; _&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;0&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Sqrt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;5&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;0&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;0&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;Public&lt;/span&gt; &lt;span class="k"&gt;Function&lt;/span&gt; &lt;span class="nf"&gt;MoveNext&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="ow"&gt;As&lt;/span&gt; &lt;span class="kt"&gt;Boolean&lt;/span&gt; _&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;Implements&lt;/span&gt; &lt;span class="n"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Collections&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IEnumerator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;MoveNext&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;_n&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;MAXN&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;_n&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;_n&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;1&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;_n&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;2&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;SetCurrent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;else&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;Dim&lt;/span&gt; &lt;span class="n"&gt;newCurrent&lt;/span&gt; &lt;span class="ow"&gt;as&lt;/span&gt; &lt;span class="kt"&gt;Integer&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;newCurrent&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; _&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Floor&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Pow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;GoldenRation&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; _&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Pow&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;0&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;GoldenRation&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;_n&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; _&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Sqrt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;5&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;0&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;SetCurrent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;newCurrent&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;End&lt;/span&gt; &lt;span class="k"&gt;If&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;Return&lt;/span&gt; &lt;span class="k"&gt;True&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;Else&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;Return&lt;/span&gt; &lt;span class="k"&gt;False&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;End&lt;/span&gt; &lt;span class="k"&gt;If&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;End&lt;/span&gt; &lt;span class="k"&gt;Function&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;Protected&lt;/span&gt; &lt;span class="k"&gt;Overrides&lt;/span&gt; &lt;span class="k"&gt;Sub&lt;/span&gt; &lt;span class="nf"&gt;Init&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c"&gt;&amp;#39;illegal value first. Foreach does a movenext&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c"&gt;&amp;#39;first before reading current value&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;_n&lt;/span&gt;&lt;span class="o"&gt;=-&lt;/span&gt;&lt;span class="n"&gt;1&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;SetCurrent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;End&lt;/span&gt; &lt;span class="k"&gt;Sub&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;End&lt;/span&gt; &lt;span class="k"&gt;Class&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;End&lt;/span&gt; &lt;span class="k"&gt;Class&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;End&lt;/span&gt; &lt;span class="k"&gt;Namespace&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To see whether this gives the same result as the original implementation I altered my main program. I walk the sequence for n=0 up to and including n=45 for both implementations. I cache the results for the first implementation. In the second foreach loop I print the results for both implementations and the difference between them. If all is correct all differences should be zero. I can use both a list or a simple array for storing the results. I chose an array here just for having used array in VB.Net. I never use arrays in C#.&lt;/p&gt;</description></item><item><title>Refactoring Fibonacci code</title><link>https://hanskruse.eu/post/2010-06-20-refactoring-fibonacci-code/</link><pubDate>Sun, 20 Jun 2010 02:01:00 -0700</pubDate><guid>https://hanskruse.eu/post/2010-06-20-refactoring-fibonacci-code/</guid><description>&lt;p&gt;I planned to experiment with Inversion of Control, unit tests and a Mockup Framework under VB.NET using Mono. For this I planned to use the Fibonacci example discussed earlier. However in its present form it is not pleasant to use, reusable or extendible. I want the following:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Move the Fibonacci code in a separate library project. This will allow me to reuse the code more easily;&lt;/li&gt;&#10;&lt;li&gt;Use a check in the MoveNext Code on n&amp;lt;45. This allows me to use &lt;em&gt;For Each&lt;/em&gt; in the mainloop and I do not need to explicitly use an Enumerator. This is more the way I am used to program in C#. I suppose this is also common practice in VB.NET. Note that this will be slower;&lt;/li&gt;&#10;&lt;li&gt;Make an Abstract IntegerEnumerable base class that also contains an Abstract enumerator. This allows me to have the plumbing code in one place and let me concentrate on variations for the MoveNext function;&lt;/li&gt;&#10;&lt;li&gt;Make a prime number finder as a variation;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;When that is done I can do some performance analysis code. I am curious about the impact of checking on &amp;lsquo;45&amp;rsquo; in the MoveNext(). Also I am interested in some variations of the MoveNext Method. First of all, I developed the abstract integerenumerable:&lt;/p&gt;</description></item><item><title>My First Fibonacci workflow</title><link>https://hanskruse.eu/post/2010-06-20-my-first-fibonacci-workflow/</link><pubDate>Sun, 20 Jun 2010 01:57:00 -0700</pubDate><guid>https://hanskruse.eu/post/2010-06-20-my-first-fibonacci-workflow/</guid><description>&lt;p&gt;When supporting a business with software one often draws diagrams of the so-called business processes. These diagrams describe the flow, the work flow, of the business process. Since .NET 3.0 there is built-in support for work flows which is augmented with a nice Visual Designer in Visual Studio 2008. With this Designer one designs the workflows graphically. These designs can be used as a means of communication to the customer and between programmer and business analyst.&lt;/p&gt;</description></item><item><title>Basic Fibonacci</title><link>https://hanskruse.eu/post/2010-06-20-basic-fibonacci/</link><pubDate>Sun, 20 Jun 2010 01:55:00 -0700</pubDate><guid>https://hanskruse.eu/post/2010-06-20-basic-fibonacci/</guid><description>&lt;p&gt;When I planned to do the Fibonacci sequence I wanted to do an IEnumerable(Of Integer) implementation first using the &amp;lsquo;yield&amp;rsquo; keyword. Well that doesn&amp;rsquo;t work in VB.NET because &amp;lsquo;yield&amp;rsquo; is something specific for C#. I had to implement a full IEnumerable and IEnumerator ;(. I started using a Console Project in MonoDevelop. I wrote a main program that will print the Fibonacci sequence from 0 to 44(maximum possible with integer).&lt;/p&gt;</description></item><item><title>Fibonacci numbers in VB.NET an outline</title><link>https://hanskruse.eu/post/2010-06-20-fibonacci-numbers-in-vbnet-outline/</link><pubDate>Sun, 20 Jun 2010 01:53:00 -0700</pubDate><guid>https://hanskruse.eu/post/2010-06-20-fibonacci-numbers-in-vbnet-outline/</guid><description>&lt;p&gt;In order to get more familiar with VB.NET I wanted to do some more programming in VB.NET. Nothing serious but a bit more serious than Hello World. I went for implementing the Fibonacci sequence(&lt;a href="http://en.wikipedia.org/wiki/Fibonacci_number"&gt;See Wikipedia&lt;/a&gt;) in VB.NET. This provides me with a vehicle to test all kinds of .NET/VB.NET plumbing code. An elaborate discussion on implementing the Fibonacci sequence using various languages and techniques can be found on &lt;a href="http://www.hanselman.com/blog/TheWeeklySourceCode13FibonacciEdition.aspx"&gt;(Scott Hanselman&amp;rsquo;s blog)&lt;/a&gt;. However in this discussion VB is only used marginally. I Want to combine the best solutions offered into one or more VB.NET implementations. The first implementation should have the following characteristics:&lt;/p&gt;</description></item><item><title>Back To Basics</title><link>https://hanskruse.eu/post/2010-06-20-back-to-basics/</link><pubDate>Sun, 20 Jun 2010 01:51:00 -0700</pubDate><guid>https://hanskruse.eu/post/2010-06-20-back-to-basics/</guid><description>&lt;p&gt;Halfway through January I quit my current job. And after a short vacation I will start with my new job which is on cycling distance from my home ;). In my new job I will return to my programming roots: Basic. In high school I started programming on the Commodore 64 in Microsoft Basic 2.0. My first serious program was a vocabulary trainer that aided me in learning natural languages. I was not a star in French or German in high school. At my new job software development is done in Visual Basic 2008 (.NET). As a C# developer that cannot be too much of a problem. Since I do not want to look like an absolute beginner. I did buy a book and began to jot down the differences and check some assumptions. For fun I do my explorations not by using Visual Studio but by using MonoDevelop and the Mono 2.01 framework on Linux. First of all, does Goto still exist? Yes it does. However line numbers do not exist as with the original BASIC dialects. Instead of that there are labels. Some children, of course not me ;) , would consider it fun to run silly programs on the demo computers shown in the local department store (V&amp;amp;D) who had some C64/MSX and the like on display in the 1980s. The most popular was something like shown below:&lt;/p&gt;</description></item></channel></rss>