From that diagram I stopped following around 3.0... lambdas and LINQ can be very useful but I don't really like var and everything later is gibberish to me.
- Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
- Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
Anyone else trying to keep up with all the newish .NET stuff?
Collapse
X
-
Originally posted by MaryPoppinsI'd still not breastfeed a naziOriginally posted by vetranUrine is quite nourishing -
var is useful in a its usually x but occassionally could be y department.Originally posted by d000hg View PostFrom that diagram I stopped following around 3.0... lambdas and LINQ can be very useful but I don't really like var and everything later is gibberish to me.
likewise optional parameters just keep the code a bit neater you don't end up with 5 functions for variations of input.merely at clientco for the entertainmentComment
-
I use implicit var and linq/lambdas all the time. Rest of the gibberish, I wash my hands of it
I am Brad. I do more than the needful and drive the market rates up by not bobbing my head.Comment
-
Isn't that what interfaces are for?Originally posted by eek View Postvar is useful in a its usually x but occassionally could be y department.
I suppose in C++ we already had part of that with default parameters, which never seemed to take on elsewhere. Though it wasn't a very elegant implementation... named+optional parameters I can see making sense.likewise optional parameters just keep the code a bit neater you don't end up with 5 functions for variations of input.Originally posted by MaryPoppinsI'd still not breastfeed a naziOriginally posted by vetranUrine is quite nourishingComment
-
var goes hand in hand with linq. It solves the issue where linq returns something that the programmer wasn't expecting.Originally posted by d000hg View PostIsn't that what interfaces are for?
I suppose in C++ we already had part of that with default parameters, which never seemed to take on elsewhere. Though it wasn't a very elegant implementation... named+optional parameters I can see making sense.merely at clientco for the entertainmentComment
-
If it returns something I wasn't expecting, I'd rather know about it than have things merrily go on doing something I hadn't planned on!Originally posted by MaryPoppinsI'd still not breastfeed a naziOriginally posted by vetranUrine is quite nourishingComment
-
I think you might have misunderstood that.Originally posted by eek View Postvar goes hand in hand with linq. It solves the issue where linq returns something that the programmer wasn't expecting.
"var" was put there to handle anonymous types - as a programmer you should know what those look like because they are limited to the body of a method. If you want one of those to escape your method (outside of closures) you're just dealing with the "object" type again and are going to need to use reflection to get at its properties.
I use "var" all the time too, do not see the need to mention the type twice when you're creating an object. I'm a bit more explicit with declarations when something is being returned from a method however.
When you declare a variable with "var" you cant just change its type like you can with a dynamic language - it's fixed due to C#'s static typing.Comment
-
Yes. To me, var means "I'm a lazy bugger. The compiler knows the type, the VS.NET knows the type, so why should I bother typing it in?"Originally posted by Jaws View PostI think you might have misunderstood that.
"var" was put there to handle anonymous types - as a programmer you should know what those look like because they are limited to the body of a method. If you want one of those to escape your method (outside of closures) you're just dealing with the "object" type again and are going to need to use reflection to get at its properties.
I use "var" all the time too, do not see the need to mention the type twice when you're creating an object. I'm a bit more explicit with declarations when something is being returned from a method however.
When you declare a variable with "var" you cant just change its type like you can with a dynamic language - it's fixed due to C#'s static typing.
Comment
-
Another gem seen in some code today.
Checking if x >= 0 and <=100Code:if (Enumerable.Range(0,100).Contains(x)) { // do stuff }
Comment
- Home
- News & Features
- First Timers
- IR35 / S660 / BN66
- Employee Benefit Trusts
- Agency Workers Regulations
- MSC Legislation
- Limited Companies
- Dividends
- Umbrella Company
- VAT / Flat Rate VAT
- Job News & Guides
- Money News & Guides
- Guide to Contracts
- Successful Contracting
- Contracting Overseas
- Contractor Calculators
- MVL
- Contractor Expenses
Advertisers
Contractor Services
CUK News
- Data Kraken v Torry Harris: 5 lessons for software developer contractors Today 06:09
- Loan Recall Case Study: Amanda Yesterday 06:00
- How IR35 inflated an £8.5bn consultancy bill — and tests Burnham at the Budget Aug 28 07:47
- Autumn Budget 2026: FCSA’s 5 contractor asks of John Healey Aug 27 04:15
- Andy Burnham's Zoom gripe doesn’t apply to IT contractors, say recruiters Aug 26 03:41
- Check your Loan Recall paperwork for the Isle of Man: it could matter Aug 25 03:27
- Budget 2026: Contractor advisers ask for ‘IR35 reset’ Aug 24 04:57
- Why might an umbrella company fail to pay its total tax bill to HMRC? Aug 18 06:08
- Contractors, here are the late payment fixes that the Lords just turned down Aug 17 08:03
- How will HMRC's Direct Debit plan affect contractors paying VAT and PAYE? Aug 13 23:54

Comment