What is the equivalent C# code for this VB.NET code?
My.Computer.FileSystem.GetFiles(....)
Code Converter (VB - C#)Adds context menu items to convert projects/files between VB.NET and C#. Flexible: Convert a small selection, or a whole solution in one go, in either direction. Accurate: Full project context (through Roslyn) is used to get the most accurate conversion.
It is that VB computes the loop bound once while C# computes the loop condition on each iteration. It is just a fundamental difference in the way the languages were intended to be used. ...is slightly faster than the equivalent in VB.
When you will go for a job in Programming then C# will be the better choice. If you first want to learn then VB could be the better choice - it depends on what is better readable for you. In both cases : what you have to learn is not the programming-language - what you have to learn is the use of the .
Yes its possible. adding c# and vb.net projects into a single solution. Step2: Project->Add reference->dll or exe of project which u added before.
The My class is VB.NET specific.
You can use the static methods of the System.IO.Directory class - e.g. Directory.GetFiles.
You can use the VB.Net's "My" in C#. It's all code, after all. In your C# project, you'd simply add a reference to Microsoft.VisualBasic
You can check out a more detailed explanation here:
http://www.codeproject.com/KB/cs/MyNamespace.aspx
I don't think there is anything in 'My' that you can't achieve without using it; but just because you aren't programming in VB.Net you have to not use it.
Having said all that - most architect type people I know would roll their eyes at you if they saw you adding a reference to VisualBasic in a C# project. But it's totally doable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With