Re: What languages do you guys know?
By: Deavmi to jagossel on Thu Mar 23 2017 05:47 pm
How is C#? Do you like the language?
I love using C# and has been the go-to (no pun intended... or was it?)
language for quick scripts in LINQPad. There has been improvements in the language over time. If you're interested and have some time, take a look at what was added to C# 5 through C# 7. They have been putting in new keywords and quirky syntax to help reduce the boiler plate coding. The .NET and Mono frameworks does help out even further.
Take a look at an example of setting a default value between C# 5 and C# 6:
// C# 5
class GraphPoint {
private int _x = 0;
public int X {
get { return _x; }
set { _x = value; }
}
private int _y = 0;
public int Y {
get { return _y; }
set { _y = value; }
}
}
// C# 6
class GraphPoint {
public int X { get; set; } = 0;
public int Y { get; set; } = 0;
}
There are many other syntax sugars in C# 7, but the defaulted auto properties from C# 6 was thhe most noted one for me.
If you work with databases a great deal, or having to deal with collections, LINQ in C# is like SQL:
var localCities =
from city in cities
where city.PostalCode = "29209"
select city;
Or use the LINQ extension method with the lambda expression:
var localCities = cities.Where(c => c.PostalCode = "29209");
Underneath the Where() extension method or the where clause in LINQ is a "yield return"; which is not executed right away until it is actually used in an actual loop without the "yield return".
I appologize for a long post, but I get really passionate about this kind of thing. I've been at the same job for 8 years where they use C#, XML, XSLT, SQL, and DSL; therefore, I have a lot of experience with C# and .NET.
-jag
Code it, script it, automate it!
---
� Synchronet � KK4QBN + (706)-422-9538 + kk4qbn.synchro.net + 24/7/365