Home / ASP.NET Weblogs

Browse by Tags

Related Posts

  • Which is the ten thousand first prime?

    Prime numbers have a good deal of practical applications (for example in cryptography) but let's face it, even if they would have none, they would still be the favorite toy of mathematicians . In Problem 7 of Project Euler , we are asked to find the 10001st element of the famous list, my approach was...
    Posted to .NET at 9.400 ft above sea level (Weblog) by Edgar Sánchez on 05-02-2008, 12:00 AM
    Filed under: C#, Functional Programming, LINQ, Math, C# 3.0, Project Euler
  • Finding the largest prime factor of a number

    This is another classic problem at Project Euler that can be solved with the old trick of top down programming, like so: PrimeFactors(number).DefaultIfEmpty(number).Max(); It's a nice solution, supposing PrimeFactors() actually returns all prime factors of any given number. But before getting there,...
    Posted to .NET at 9.400 ft above sea level (Weblog) by Edgar Sánchez on 04-19-2008, 12:00 AM
    Filed under: Functional Programming, LINQ, Math, C# 3.0
  • Project Euler and infinite sequences in C#

    The second problem at Project Euler proposes: Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... Find the sum of all the even-valued terms in the sequence which do not exceed...
    Posted to .NET at 9.400 ft above sea level (Weblog) by Edgar Sánchez on 04-17-2008, 12:00 AM
    Filed under: Functional Programming, LINQ, C# 3.0
  • Understanding C# 3.0 Features (8) Partial Method

    [ LINQ via C# series ] The is a very simple feature. From partial class to partial method Partial class is introduced by C# 2.0. With the partial keyword, the definition of one type is able to be divided into several files. For example, if creating a WinForm application project in VisualStudio, the MainForm...
    Posted to Dixin's Blog (Weblog) by Dixin on 12-16-2009, 12:00 AM
    Filed under: .NET, C#, LINQ, LINQ via C# Series, C# 3.0
  • Understanding C# 3.0 Features (6) Lambda Expression

    [ LINQ via C# series ] Lambda expression is another powerful syntactic sugar making C# functional. In this post, “Lambda expression” simply means “C# Lambda expression”. The native concept of lambda expression will be introduced in the later lambda calculus posts. According to MSDN : A lambda expression...
    Posted to Dixin's Blog (Weblog) by Dixin on 11-29-2009, 12:00 AM
    Filed under: .NET, C#, JavaScript, LINQ, LINQ via C# Series, Haskell, F#, C# 3.0, Functional Programming
  • Understanding C# 3.0 Features (5) Extension Method

    [ LINQ via C# series ] Extension method is a fancy and powerful syntactic sugar in C# 3.0. Extension methods are very important when writing functional style C# code. Define an extension method for a class When we define an extension method for a type, this extension method must: be a static method be...
    Posted to Dixin's Blog (Weblog) by Dixin on 11-28-2009, 12:00 AM
    Filed under: .NET, C#, LINQ, LINQ via C# Series, C# 3.0, Functional Programming
  • Understanding C# 3.0 Features (4) Anonymous Type

    [ LINQ via C# series ] This feature provides a way to create an instance without declare the type: var mark = new { Name = "Mark" , Age = 18 }; Since the type name is unknown at this time when writing code, this is called a anonymous type. Compilation At compile time, the compiler will generate the following...
    Posted to Dixin's Blog (Weblog) by Dixin on 11-27-2009, 12:00 AM
    Filed under: .NET, C#, LINQ, LINQ via C# Series, C# 3.0
  • Understanding C# 3.0 Features (2) Object Initializer And Collection Initializer

    [ LINQ via C# series ] Take this Person type as an example: public class Person { public string Name { get ; set ; } public int Age { get ; set ; } } Object initializer In C# 2.0 we create an Person instance and initialize it like this: Person person = new Person (); person.Name = "Mark" ; person.Age...
    Posted to Dixin's Blog (Weblog) by Dixin on 11-26-2009, 12:00 AM
    Filed under: .NET, C#, LINQ, LINQ via C# Series, C# 3.0
  • Understanding C# 3.0 Features (1) Automatic Property

    [ LINQ via C# series ] As the fundamental of LINQ, This chapter will explain the new language features of C# 3.0, all of which are syntactic sugars. This part is about the automatic property. In C# 2.0 a property can be declared like this: public class Person { private string _name; public string Name...
    Posted to Dixin's Blog (Weblog) by Dixin on 11-26-2009, 12:00 AM
    Filed under: .NET, C#, LINQ, LINQ via C# Series, C# 3.0
  • Understanding C# 3.0 Features (7) Query Expression

    [ LINQ via C# series ] This kind of code has been introduced again and again: var positive = from number in source where number > 0 orderby number descending select number.ToString( CultureInfo .InvariantCulture); This is called the query expression syntactical sugar, providing a T-SQL-like way to...
    Posted to Dixin's Blog (Weblog) by Dixin on 12-16-2009, 12:00 AM
    Filed under: .NET, C#, LINQ, LINQ via C# Series, C# 3.0
Page 1 of 2 (12 items) 1 2 Next >