szabototo89 / CodeSharper

Refactoring tool, written in C# and using TDD for developing
1 stars 0 forks source link

[core] Redesign Optional type #40

Closed szabototo89 closed 9 years ago

szabototo89 commented 9 years ago

I should redesign and refactor Optional type. It should be similar to Scala version.

Optional<Int32> value = Optional.None;
Optional<String> value2 = Optional.Some("Hello World!");
szabototo89 commented 9 years ago

It is finished and renamed to Option class. It supports filtering and mapping too:

   var value = Option.Some(10).Map(v => v + 1);  // == Some(11)
   var negative = Option.Some(12).Filter(v => v < 0); // == None