News for hackers. Stuff that matters.
Re:Microsoft takes .NET open source and cross-platform by hokkos on Wednesday November 12, 2014 @05:18PM (#8598642)
Can you give me examples of implicits in C# ? I am unable to see a parallel.
Re:Microsoft takes .NET open source and cross-platform by jakevn on Wednesday November 12, 2014 @05:53PM (#8598820)

  using System;
  
  public class Program
  {
  
  public class Person
  {
    private string _name;
    private int _age;
    
    public Person(string name, int age)
    {
      _name = name;
      _age = age;
    }
		
    public static implicit operator int(Person p)
    {
      return 42;
    }
  }
	
  public static void Main()
  {
    var person = new Person("Jim", 51);
    var number = 100;
    AdditionPrinter(person, number); // Prints 142
  }
	
  public static void AdditionPrinter(int a, int b)
  {
    Console.WriteLine(a + b);
  }
  
  }
Re:Microsoft takes .NET open source and cross-platform by seanmcdirmid on Wednesday November 12, 2014 @07:10PM (#8599171)
Also consider extension methods, which serve some of the same purpose as implicits in Scala.