Community discussion forum

New C# 3.0 Language Features

This is a comment thread discussing New C# 3.0 Language Features
  • 9 years ago

    This thread is for discussions of New C# 3.0 Language Features.

  • Advertisement

    Simply the fastest line-level profiler for .NET ever

    “The low overhead means it has minimal impact on the execution of my program”
    Mark Everest, Development Team Leader, Renault F1 Team Ltd.

    Try out the new ANTS Profiler 4 for yourself. Download your 14-day trial now

  • 1 month ago

    Hi,

    Is it possible to use for example " If statement " when defining a field of an Anonymous Type?

    Thanks,

  • 1 month ago

    Hi Matt, welcome to developerFusion!

    You can use an inline conditional statement to vary the value... but you can't use it to define different sets of types. For instance, you can do this:

    var someAnonObject = new { Name = (1 == 0 ? "James" : "Matt" ) }
    

    anything more complex than that should probably be done outside of the object creation itself....

    Hope that helps

    Post was edited on 17/10/2008 19:20:50 Report abuse
  • 1 month ago

    Hi James,

    It sounds interesting , Thank you very much indeed.

Post a reply

Enter your message below

Sign in or Join us (it's free).