As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I am making a program in C# with a lot of IO operations.
Some of that operations are copying directories.
I was really stunned when I figured out that you don't have something like Directory.copy(SourceDir, DestinationDir) in C#.
I googled a little bit around and at msdn they give a code sample to copy directories.
(http://msdn.microsoft.com/en-us/library/bb762914.aspx).
But when you search a little bit further, there is a Directory.Copy method in the Microsoft.VisualBasic.FileIO namespace.
(http://msdn.microsoft.com/en-us/library/ms127957.aspx)
I could refere to this namespace and use this method, but there must be a reason why Microsoft does not support this in C# and why they aren't mentioning it on msdn.
Hope somebody can tell me the reason.
I can write extensionmethod to solve this problem & I can solve it pretty easy, but my question is Why? Why is there no such method in C#, I just want to know :-)
Because it's easy enough to do a foreach on a DirectoryInfo.GetFiles(), while also giving you an opportunity to filter the list of files being copied, or do some other operation besides copying.
If it really bothers you, write an extension method for the DirectoryInfo class, or a FileInfo[] collection.
My guess is that VB is oriented more on beginners and things like Microsoft.VisualBasic.FileIO were intended to attract them to .NET world.
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Can you advise me an a resource with simple C# LINQ/lambda-expressions code exercises?
Desirable but not obligatory: online, free, with answers, step by step, the simplest and fast, to study the syntax but not complicated puzzles or world problems.
I do not think it is duplicated with
Learning C# with exercises, questions and puzzles
since it was 2+ years ago, so propably outdated, and it did not contain any good reference (looked through all of them).
The best google search result I managed to find is:
C# exercises and solutions-C# variables and data types
though I am not satisfied.
Update:
Something similar to LINQ Quiz which is for me the best reference I could find to this moment.
A very good ressource for LINQ is Jon Skeet's blog "Reimplementing LINQ to Objects".
He reimplements the whole LINQ functionality step by step giving excellent insights about the inner workings.
Reimplementing LINQ to Objects
This is not a tutorial of such but I've found it very usefull for the linq side of things...
http://code.msdn.microsoft.com/101-LINQ-Samples-3fb9811b
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Alright, I've been spoiled enough already by IDEs, and I want to learn how to use the prompt to compile code.
Where can I find good learning material, me being completely oblivious to the matter? To be more specific, I'd like to know how to use C#'s csc.exe fully, though I hope that the knowledge will be appliable to other compilers as well.
Most compilers (as well other command line tools) provide help by using "/?" option - read it and in most cases it is enough to get simple code compiled.
For more real cases use project files
*.csproj for C#/ *.vbproj for VB.Net , use MSBuild to build. You already have them if you ever created project in VS.
makefiles for many other compilers
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
As proposed by Brandon Walkin (for Xcode, but same thing), more visualization in the IDE can help productivity. In particular, I'd like to provide little icons to better convey the meaning of enum choices or classes (such as UI controls), roughly like this:
The built-in XML comment syntax clearly doesn't support this, but maybe someone has written an add-in to add support for, say, a <img> tag?
Man I love the Visual Studio Gallery for all the good things it contains.
Never seen anything like what you suggest there, but have seen plugin's for adding that kind of content to comments tho. This is one that I can find in there now (http://visualstudiogallery.msdn.microsoft.com/e216ec81-730b-4022-8305-25c39eb1f820), but I distinctly remember that there used to be one that allowed you to link to an image file (an export from say visio or it's ilk), and it would display it inline. I can't find it now tho :-(
You might want to look at this one, which is close, but not quite on the money http://visualstudiogallery.msdn.microsoft.com/c3eaa4fc-f2de-43ad-92ee-f0f257b79005. The source code is available here: http://csharpintellisense.codeplex.com/
And I'd actually like to thank you for drawing my attention back to that fabulous repository of goodness.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
College student about to major in CS. Just want to know if it really matter what language you learn first?
Seems to me CS and the nature of our work is about problem solving. Different language seems to differ in syntax, libraries you can use, etc. etc. But when it comes down to it, if you know how to solve a particular problem in one language, you could do it in other languages as well right? I mean surely some languages are better tools and can do a more elegant job, but at the end of the day the ideas are still the same right?
It doesn't matter what language you use. The algorithm underneath is the main thing that matters.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Is there a feature equivalent to C#'s regions for being able to group code into named blocks and collapse and expand them?
Alternatively, are there any workarounds or third party tools available to achieve the same result?
One possible workaround might be using F# Outlining VS Extension that provides //#region outlining functionality. I use it with VS2010 for couple of months without any problems and find it very convenient:
[-]//#region Region Name
--lines of F# code--
--lines of F# code--
--lines of F# code--
//#endregion
with one click collapses to
[+]Region Name
and back.
I found times ago (out of mine curiosity) the link the was searching on for asking this question.
If you look at Regions and navigation bar for F# in Visual Studio the guy seems implemented an experimental feature. Post of firsts of 2012, so it's pretty fresh stuff.
Should say that I didn't try it till now.
Good luck.