Convertire codice da VB.NET a C#, e viceversa

giovedì, 21 febbraio 2008 11.28 by Marco Bellinaso

A volte capita di dover convertire in fretta codice da VB.NET a C#, o viceversa. Magari perchè si trova in rete giusto la classe helper che fa al caso proprio, ma scritta in un linguaggio diverso da quello adottato dal proprio team. O magari è un collega di un'altro team (che sviluppa con un altro linguaggio) che ci passa il codice. Non sempre si può o si vuole semplicemente compilare quella classe in un assembly separato e riutilizzarla in quel modo...a volte, per pezzi di codice non troppo grossi, si può decidere di avere tutto all'interno del proprio progetto, in un linguaggio uniforme.

Già da anni ci sono in giro tool per convertire in automatico codice da VB.NET a C# e viceversa; tutti hanno qualche piccolo o grande problema o mancanza però. Problemi di correttezza della conversione in primis, ma anche problemi di interfaccia utente. Il nuovo Code Converter di Telerik si propone come la migliore soluzione free disponibile, offrendo tra le alte cose:

  • Possibilità di convertire file multipli in un colpo solo, scaricando poi un file .zip con l'intero risultato
  • Possibilità di convertire snippet di codice che non costituiscano un'intera classe (come quasi sempre richiesto dagli altri tool)
  • Possibilità di ottenere il codice generato sotto forma di HTML formattato, con syntax coloring e line numbering (perfetto per chi vuole del codice da incollare in un blog)
  • Possibilità di usare il servizio non solo tramite interfaccia web, ma anche tramite gadget per Vista, Yahoo! e Google (e probabilmente a breve tramite add-in all'interno di Visual Studio)
  • Supporto tecnico tramite forum dedicato
Per l'effettiva conversione del codice viene usata NRefactory, libreria open-source sfruttata anche da altri convertitori; a parte la qualità della conversione sono però i dettagli elencati sopra che fanno la differenza in questo caso. Il fatto poi che il progetto sia supportato da Telerik (uno tra i migliori produttori di componenti professionali per .NET) è una garanzia per la qualità del tool.

Correntemente valutato 5.0 da 1 utenti

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Segnala:  
Tags:   ,
Categorie:   Sviluppo software
Azioni:   E-mail | Permalink | Commenti (52) | RSS CommentiRSS comment feed

Post correlati

Commenti

dicembre 25. 2008 16.53

Busby SEO Test

maybe i should try this

Busby SEO Test

marzo 6. 2009 18.49

Urban Net Zone

thanks for the help of "Convertire codice da VB.NET a C#, e viceversa"

Urban Net Zone

aprile 12. 2009 11.06

aassdasd

<!-- code formatted by http://manoli.net/csharpformat/ -->
<pre class="csharpcode">
<span class="kwrd">Private</span> <span class="kwrd">Sub</span> Command1_Click()
<span class="kwrd">Dim</span> Size <span class="kwrd">As</span> <span class="kwrd">Long</span>, Remaining <span class="kwrd">As</span> <span class="kwrd">Long</span>, FFile <span class="kwrd">As</span> <span class="kwrd">Integer</span>, Chunk() <span class="kwrd">As</span> <span class="kwrd">Byte</span>
<span class="kwrd">Dim</span> FileName <span class="kwrd">As</span> <span class="kwrd">String</span>, NowSize <span class="kwrd">As</span> <span class="kwrd">Long</span>, Yuzde <span class="kwrd">As</span> <span class="kwrd">Integer</span>
FileName = Right(Text1.Text, Len(Text1.Text) - InStrRev(Text1.Text, <span class="str">"/"</span>))
Inet1.Execute Trim(Text1.Text), <span class="str">"GET"</span>
<span class="kwrd">Do</span> <span class="kwrd">While</span> Inet1.StillExecuting
DoEvents
<span class="kwrd">Loop</span>
ProgressBar1.Max = 100: Command2.Enabled = <span class="kwrd">True</span>
Size = <span class="kwrd">CLng</span>(Inet1.GetHeader(<span class="str">"Content-Length"</span>))
Remaining = Size
NowSize = 0
StatLab(0).Caption = Size
FFile = FreeFile
Open <span class="str">"c:\"</span> &amp; FileName <span class="kwrd">For</span> Binary Access Write <span class="kwrd">As</span> #FFile
<span class="kwrd">Do</span> <span class="kwrd">Until</span> Remaining = 0
<span class="kwrd">If</span> Form1.Tag = <span class="str">"cancel"</span> <span class="kwrd">Then</span> Inet1.Cancel: MsgBox <span class="str">"file download aborted"</span>: <span class="kwrd">End</span>
<span class="kwrd">If</span> Remaining &gt; 1024 <span class="kwrd">Then</span>
Chunk = Inet1.GetChunk(1024, icByteArray)
Remaining = Remaining - 1024
<span class="kwrd">Else</span>
Chunk = Inet1.GetChunk(Remaining, icByteArray)
Remaining = 0
<span class="kwrd">End</span> <span class="kwrd">If</span>
NowSize = Size - Remaining
Yuzde = <span class="kwrd">CInt</span>((100 / Size) * NowSize)
StatLab(1).Caption = NowSize
StatLab(2).Caption = Size - NowSize
StatLab(3).Caption = <span class="str">"% "</span> &amp; Yuzde
ProgressBar1.Value = Yuzde
Put #FFile, , Chunk
<span class="kwrd">Loop</span>
Close #FFile
MsgBox <span class="str">"File downloaded"</span>
<span class="kwrd">End</span> <span class="kwrd">Sub</span>

<span class="kwrd">Private</span> <span class="kwrd">Sub</span> Command2_Click()
Form1.Tag = <span class="str">"cancel"</span>
<span class="kwrd">End</span> <span class="kwrd">Sub</span>
</pre>

aassdasd

dicembre 28. 2009 09.31

payday loans

Do you have any more info on this?

payday loans

dicembre 30. 2009 02.17

New Jersey Payday Loans

Thank you for your help!

New Jersey Payday Loans

gennaio 3. 2010 15.27

fast payday loans

You made some good points there. I did a search on the topic and found most people will agree with your blog.

fast payday loans

gennaio 11. 2010 07.41

Plastic Surgeon Orange County

Q: Did you hear about the blonde man that locked his keys in his car?
A: Took him an hour to get his family out w/ a coat hanger.



Regards
Peng






Plastic Surgeon Orange County

gennaio 12. 2010 13.43

cataracts eye drops

A Sunday School teacher asked her class why Joseph and Mary took Jesus with them to Jerusalem. A small child replied: "They couldn't get a baby-sitter."


Regards
Shelton

cataracts eye drops

gennaio 20. 2010 11.49

kuranda dog beds

It's illegal to hunt from the back of an animal.

Illegal for a man to give his sweetheart a box of candy weighing less than fifty pounds.

You may not fish on a camel's back.

Riding a merry-go-round on Sundays is considered a crime.

Boise: Residents may not fish from a giraffe's back.

Coeur d' Alene: If a police officer approaches a vehicle and suspects that the occupants are engaging in sex, he must either honk, or flash his lights and wait for three minutes before approaching the car.

Idaho Falls, Idaho: If you're 88 years of age or older, it's illegal for you to ride your motorcycle.

Pocatello: A law passed in 1912 provided that "The carrying of concealed weapons is forbidden, unless some are exhibited to public view"

Pocatello: A person may not be seen in public without a smile on their face.



Regards
Mcelyea








kuranda dog beds

febbraio 13. 2010 11.08

teeth whitening products

I admire what you have done here. I like the part where you say you are doing this to give back but I would assume by all the comments that this is working for you as well.

teeth whitening products

febbraio 16. 2010 14.58

Colon cleansing

This is a really good read for me, Must admit that you are one of the best bloggers I ever saw.Thanks for posting this informative article.

Colon cleansing

febbraio 22. 2010 11.59

Acne products

I am not really sure if best practices have emerged around things like that, but I am sure that your great job is clearly identified. I was wondering if you offer any subscription to your RSS feeds as I would be very interested and can?t find any link to subscribe here.

Acne products

febbraio 26. 2010 01.20

paydayloans

This is a really good read for me, Must admit that you are one of the best bloggers I ever saw.Thanks for posting this informative article.

paydayloans

febbraio 27. 2010 19.43

cash advance

Very, very cool site site! I am loving it!! Will come back again - taking you feeds also, Thanks.

cash advance

marzo 3. 2010 11.37

best weight loss pills

Congratulations for that winning shot!

best weight loss pills

marzo 4. 2010 16.24

flash based chat

Valuable information and excellent design you got here! I would like to thank you for sharing your thoughts and time into the stuff you post!! Thumbs up

flash based chat

marzo 5. 2010 09.43

pass a hair drug test

Found your place on del.icio.us today and truly liked it.. i bookmarked it and leave be bet to defend it out several statesman afterwards

Regards
Cox








pass a hair drug test

marzo 6. 2010 01.53

gazeteler

Fine information, many thanks to the author. It is puzzling to me now, but in general, the usefulness and significance is overwhelming. Very much thanks again and good luck!

gazeteler

marzo 6. 2010 11.16

learn forex trading

Never seen such composed collection. I scan it all the way to the end. Prepare them arrival.


Regards
Westphal

learn forex trading

marzo 6. 2010 16.23

no credit check loans

I wasn't aware of the many ripples and depth to this story until I surfed here through Google! Great job. Big thanks for the useful info i found on Convertire codice da VB.NET a C#, e viceversa.

no credit check loans

marzo 9. 2010 10.52

replica watches

thanks for the share

replica watches

marzo 10. 2010 11.23

cash loans

Hello, I found your blog in a new directory of blogs. I dont know how your blog came up, must have been a typo, Your blog looks good. Have a nice day. Big thanks for the useful info i found on Convertire codice da VB.NET a C#, e viceversa.

cash loans

marzo 12. 2010 09.21

cosmetic dentist sacramento

Hey - squeamish website, honourable search around some blogs, seems a pretty overnice program you are using. I'm currently using Wordpress for a few of my sites but hunt to transfer one of them over to a construction related to yours as a endeavor run. Anything in portion you would advise some it?

Regards and respect
Mannings







cosmetic dentist sacramento

marzo 13. 2010 12.40

Scary Halloween Masks

Any idea where I could get English version of it?I desperately need it!Thanks for any advise!

Scary Halloween Masks

marzo 15. 2010 13.14

Stretch marks

Hey very nice blog!! Man .. Beautiful .. Amazing .. I will bookmark your blog and take the feeds also...

Stretch marks

marzo 22. 2010 10.18

Dragon games

Any idea where I could get English version of it? thanks in advance

Dragon games

marzo 22. 2010 10.19

Golf games

I wish i could understand i need it to be in English, any help?

Golf games

marzo 22. 2010 15.04

ssk sorgulama

This is a really good read for me, Must admit that you are one of the best bloggers I ever saw.Thanks for posting this informative article.

ssk sorgulama

marzo 22. 2010 22.20

cure for genital warts

Resources like the one you mentioned here will be very useful to me! I will post a link to this page on my blog. I am sure my visitors will find that very useful. Big thanks for the useful info i found on Convertire codice da VB.NET a C#, e viceversa.

cure for genital warts

marzo 23. 2010 16.20

ehliyet

Aw, this was a really quality post. In theory I'd like to write like this too - taking time and real effort to make a good article... but what can I say... I procrastinate alot and never seem to get something done.

ehliyet

marzo 24. 2010 15.05

rolex replica

thank you

rolex replica

marzo 24. 2010 16.41

credit card debt solution

Thank you for another great article. Where else could anyone get that kind of information in such a perfect way of writing? I have a presentation next week, and I am on the look for such information.

credit card debt solution

marzo 25. 2010 14.53

bağkur

I wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post

bağkur

marzo 25. 2010 19.16

girl games

Thank you for sharing that.

girl games

marzo 25. 2010 19.17

Dora games

great post, thank you I enjoyed reading that.

Dora games

marzo 25. 2010 23.34

gout pain relief in 2 hours

I wish you a productive implementation of the concept and will be waiting for much more intriguing tips from you. Thank you extremely significantly for sharing your concepts.

gout pain relief in 2 hours

marzo 27. 2010 10.15

Dental Insurance For Individuals

i was beginning to believe that i could be the sole woman whom cared about this, at the least at current i recognize i'm not loony Smile i'm going to make it a stage to look at some various posts just after i get a tad of caffeine in me, it is usually rough to examine without having my coffee, i am about to to have fun with my facebook poker chips cheers

Dental Insurance For Individuals

marzo 29. 2010 22.40

home remedies for nail fungus

As a Noob, I am always seeking online for articles that can help me. Big thanks for the useful info i found on Convertire codice da VB.NET a C#, e viceversa.

home remedies for nail fungus

marzo 30. 2010 03.23

Emerald Cut Engagement Rings

Excellent read, I just passed this onto a colleague who was carrying out a little research on that. And he basically bought me lunch because I observed it for him smile So let me rephrase that: Many thanks for lunch!

Emerald Cut Engagement Rings

marzo 30. 2010 05.58

recycle ink cartridges

Hey everybody. Interesting topic for a website. I was just surfing the World wide web for fun when I identified your site. Terrific submit. Many thanks a great deal for sharing your thoughts! It really is encourging to know that some people still put in an work into managing their websites. I'll be certain to look in again real soon.

recycle ink cartridges

marzo 30. 2010 14.02

dirt cheap rims

Easily, the submit is actually the sweetest topic on curing acne naturally. I agree with your conclusions and will thirstily look forward for your forthcoming updates. Just saying thanks will not just be enough, for the phenomenal clarity inside your creating. I will immediately grab your rss feed to stay abreast of any updates.

dirt cheap rims

aprile 4. 2010 16.55

poor credit auto loans

Me and my friend were arguing about an issue similar to this! Now I know that I was right. lol! Thanks for the information you post.

poor credit auto loans

aprile 8. 2010 02.18

Emerald Cut Engagement Rings

That's excellent details. I learned a lot specifically about what you pointed out. This is all new to me. Many thanks for that wonderful write-up, If I'm using firefox, how do I add RSS and feeds to my browser?

Emerald Cut Engagement Rings

aprile 8. 2010 16.09

gerdek gecesi

I wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post

gerdek gecesi

aprile 10. 2010 03.21

how to get a six pack

You made some very good points below. A very educational a single I was searching for it. Keep up the good work and would like to hear far more from you.

how to get a six pack

aprile 10. 2010 17.11

natural cleanse

Power is the ability to do good things for others.

natural cleanse

aprile 11. 2010 05.26

six pack abs workout routine

Many thanks for ones post and for every document you write! I get actual pleasure whilst looking and reading as a result of your resource.

six pack abs workout routine

aprile 11. 2010 05.26

the truth about six pack abs review

Many thanks for the useful data. It had been really practical for me. Maintain sharing this kind of strategies from the long term as properly.

the truth about six pack abs review

aprile 12. 2010 04.04

Low Cost Dental Insurance

Just wish to say your document is brilliant. The clarity with your post is basically impressive and i can assume you happen to be an expert on this subject matter. Properly with your permission allow me to grab your rss feed to retain up to date with succeeding publish. Many thanks a million and please maintain up the strong operate.

Low Cost Dental Insurance

aprile 12. 2010 09.34

repair your credit

this can be an incredible web site.i constantly come across some thing new & different the following.thank you for that info.

repair your credit

aprile 13. 2010 19.46

ucuz tatil

really good

ucuz tatil

aprile 13. 2010 20.30

best cellulite treatment

I don’t usually reply to posts but I will in this case. WoW Smile Big thanks for the useful info i found on Convertire codice da VB.NET a C#, e viceversa.

best cellulite treatment

Commenti chiusi