>Usually if i want to test a small piece of c# code out of context, i use Code. Same thing when i'm testing some prof of concept, Code is great for that.
Shoutout to LINQPad which is perfect for this, I use it constantly at work and at home.
If you can't afford LINQPad there's also RoslynPad, which is also very good :)
LINQPad works great for this too. It does more than just LINQ to SQL. It's a great little scripting tool for building out console and test apps without going into a full solution in visual studio.
Also, the latest beta includes an interactive tutorial on async functions
If you're looking for something like IRB for C#, then check out LINQPad
The free version doesn't have intellisense, but it's still a great tool and very useful for quickly prototyping things.
Also, do you really think most C# developers aren't used to lambdas these days? Most people I've worked with over the last few years have really embraced the more functional aspects of C# and lambdas are incredibly prevalent.
JavaScript is mostly used a web-centric language. If you intend to build web sites or work for a non-tech corporation, it is a very good language to learn.
Other popular and quite flexible languages include Java, C/C++/C# and Python.
Linqpad is a good program to use to learn JavaScript and/or C#.
Netbeans or Eclipse are good IDEs (program used to code smoothly) to work with Java/C.
These are tools that can help you learn to program on a Windows machine but there is a world of other material out there to explore...if you're brave, want to strain your eyes and acquire a fear of the sun.
=)
Linqpad will give you the resulting SQL query generated by your Linq query. It's a free tool, and $45 will give you Intellisense. Worth every penny, in my opinion.
Have you tried using LINQPad? It lets you whip off tiny scripts (expression, statements, or full program) along with other benefits (database connections, extension methods, saving/loading from your file system)
It's not a REPL by definition, but I find it more useable than a REPL and with just as little overhead of a REPL.
Consider the free and awesome LinqPad.
Once you install it, there is a Samples tab in the bottom left. If you go to the Download/import more samples area, the "C# 4.0 in a Nutshell" samples are gold.
They are a series of tutorials that you can execute from within LinqPad. Super easy to start, and each chapter builds on the next. Good luck man.
LINQPad. http://www.linqpad.net/
I cannot recomment this utility enough and I'm surprised no one's mentioned it here yet. It was invaluable to my LINQ learning efforts. It's a code scratch pad with a "dump" window so you can view the results of code instantly without having to code your own display functions. It's great to change something in the LINQ Query and to be able to immediately see how the change you made affects the outcome.
Others have posted some pretty good resources, and LINQPad comes with its own little tutorial section as well.
I really recommend LinqPad. It's a small application which enables you to run small code snippets or programs without having to set up a solution and project in Visual Studio. It's just code, and result. Perfect application to learn C#, or VB, or Linq, or C++, or SQL.
Get it here: http://www.linqpad.net/
It's free, but to get intellisense you need to purchase a license.
I like this. Linq Pocket Reference by the same guy who wrote linqpad which you should also get to know
I've been using LinqPad to quickly test C#/VB code. You just wrote code without the usual boilerplate (defining the main method and class, the popular namespaces included by default) and just ran it.
It's a heck of a lot slower than Roslyn since it doesn't use Roslyn plus you've got to pay for intellisense in LinqPad. Although LinqPad is a great tool for what it was designed for, I can't imagine people paying for Autocompletion and whatever other extras they offer when Roslyn gets mature enough.
Also, I really don't get the point of the .csx file. The first program I made gave me a run-time error. My own fault since I didn't notice the red squiggly when I forgot to use the out
keyword on a TryParse
method but there seems to be very little benefit from using the scripting file. The interactive window is enough for testing some code and if you need to have something more permanent, why use CS script?
To develop you need Visual Studio, there is a free community edition (also called Visual Studio Express)
https://www.visualstudio.com/en-us/products/visual-studio-express-vs.aspx
I highly recommend LINQPad ( http://www.linqpad.net) scratchpad for playing with C#, LINQ, VB etc. This is great tool for learning aswell as experimenting.
Functional programming is in rise now (mainly because of BigData), learn LINQ which is not only simple to read but also very powerful and provides great flexibility in handling data(collections) etc.
Also Xamarin studio (which is recently bought by Microsoft) https://www.xamarin.com/visual-studio is very useful if you like to develop in .NET, C#,VB etc for other platforms like Apple Mac OS or iPAD or iPhone, Android..
The code doesn't compile as-is: either you switched places with an else and the catch statement, or you have an extra else statement. Try using LinqPad or .Net Fiddle to create a working example, like this.
Besides that, why is it slow? When you talk about performance, you need to have a measurable goal to hit. How much faster does it need to be? Is there a measurable performance problem with it?
That's unfortunate.
In that case, yeah, get the command line up and running. I would strongly recommend you grab the free Visual Studio Community 2015 and maybe even LINQPad to support your studies. At minimum, they'll help you with learning/experimenting, and with basic code editing (syntax highlighting, autocomplete, compiler error/warning management). Even if you can't use them to submit your work, or use in-class, they'll help you learn the language and the .NET platform a lot easier than just the command line compiler.
You could get some inspiration from this guy:
https://github.com/paulyoder/LinqToExcel#welcome-to-the-linqtoexcel-project
Or team up with the LinqPad guys:
http://www.linqpad.net/howlinqpadworks.aspx
Rosyln could be of some use but I suspect it would be a lot of work.
C#
var input = new List<string>() { "4", "/bin/thing:/bin/thing-3", "/bin/thing-3:/bin/thing-3.2", "/bin/thing/include:/usr/include", "/bin/thing-3.2/include/SDL:/usr/local/include/SDL", "/bin/thing/include/SDL/stan" };
int linksCount = int.Parse(input[0]); var links = new Dictionary<string, string>();
for(int i = 0; i < linksCount; i++) { int currentLink = i + 1; var split = input[currentLink].Split(':'); links.Add(split[0], split[1]); }
Func<string, string> resolve = (trash) => "trash"; resolve = (directory) => { var folders = directory.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
var result = ""; foreach(var folder in folders) { result += "/" + folder; if(links.ContainsKey(result)) { result = links[result]; result = resolve(result); } }
return result; };
Console.WriteLine(resolve(input.Last()));
Tested with LinqPad.
If you're starting out with LINQ then you would benefit from installing and learning to use LINQpad. Much faster to prototype queries than following the edit/compile/debug cycle. Only limitation in the free version is the lack of Intellisense but once you've added a reference to your EntityFramework object context DLL the model is available for reference in a side panel.
One of the query output options is to view the lambda representation of your query, as well as the generated SQL query.
C# in a nutshell is very good if you already know programming. Having all the samples available through LINQPad (which the author wrote) is just all kinds of great too, since it lets you try things out right then and there.
In any case, do yourself a favor and get LINQPad. It's a fantastic C# code scratchpad.
Along this vein: LinqPad. It's free, unless you want autocomplete and a few other things. But if you're like me, and LINQ actually comes easier than SQL, you'll use this instead of SSMS.
Plus, you can get your queries right in it, then paste them into your programs.
Oops, sorry. It's a utility method available in LINQPad (with which I wrote/tested the above code). In this particular case, it's pretty much equivalent to Console.WriteLine
:
for (int i = 0; i < 5; i++) { Console.WriteLine(FastDateTime.FastNow); Thread.Sleep(5000); }
You may want to look at LinqPad - it is a very nice interactive c# code runner. The free version works well, but you have to pay for a code completion. It is worth the money if you do c# full time.
http://www.linqpad.net/ is a good tool that lets you interact with various database systems using LINQ, plus it has some other nifty features for the DBA who doubles as an application developer. But I agree it'd be nice if SSMS would incorporate a LINQ interface into itself outside of building a SQL to LINQ class in C#.
I guess you aren't aware that you can add a connection to your strongly typed EF data model and context?
http://www.linqpad.net/EntityFramework.aspx
Even better, you can view the resulting SQL generated by the query.