4

I've seen this question about advice for C# programmers writing Python code but I am going the opposite direction.

What are some tips, tricks, caveats for a Python programmer writing C# code?

Community
  • 1
  • 1
Lukas Cenovsky
  • 5,476
  • 2
  • 31
  • 39

1 Answers1

2

Here are some examples I meant by my question:

  • enumerate() in C#

    another possibility:

    "abc".Where((x,i) => true).Select((x, i) => string.Format("{0}: {1}", i, x))
    
    0: a
    1: b
    2: c
    
  • list comprehension in C#

    List<Foo> fooList = new List<Foo>();
    IEnumerable<Foo> extract = from foo in fooList where foo.Bar > 10 select Foo.Name.ToUpper();
    
Community
  • 1
  • 1
Lukas Cenovsky
  • 5,476
  • 2
  • 31
  • 39
  • i used to have to switch between python and C# all the time and when LINQ came out, it made me so happy to have list comprehension-ish stuff available. – Tom Willis Jan 15 '11 at 22:52