The Power of .NET: A Multilanguage Example
We conclude this appendix by working through a complete, though small, example of how the .NET Framework enables different languages to be combined to solve a problem.
Many programming courses cover the generation of prime numbers using an algorithm known as “the Sieve of Eratosthenes.” Primes are useful in many applications, including hashing algorithms and cryptography, so being able to generate them easily is useful on a practical level.
The Sieve of Eratosthenes in C#
The method in Listing G.3[6] is an implementation of the Sieve of Eratosthenes in C#.
[6] We use the common idiom of using division to check for multiples. A “true” sieve uses index incrementing and involves no division, but the method ...
Get Programming in the .NET Environment now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.