Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Visual Basic needs more credit

Visual Basic needs more credit

Scheduled Pinned Locked Moved The Lounge
206 Posts 32 Posters 572 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Colborne_Greg

    VB New image with {.height = height} C# New image {height = height} second one fails

    Richard DeemingR Offline
    Richard DeemingR Offline
    Richard Deeming
    wrote on last edited by
    #84

    Colborne_Greg wrote:

    second one fails

    No, it doesn't. https://dotnetfiddle.net/J0N7Mm[^]

    using System;

    public class Program
    {
    public static void Main()
    {
    int height = 100;
    var image = new Image { height = height };
    Console.WriteLine("The image's height is {0}.", image.height);
    }
    }

    public class Image
    {
    public int height { get; set; }
    }

    Output: The image's height is 100.


    "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

    "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

    C 2 Replies Last reply
    0
    • Richard DeemingR Richard Deeming

      Colborne_Greg wrote:

      second one fails

      No, it doesn't. https://dotnetfiddle.net/J0N7Mm[^]

      using System;

      public class Program
      {
      public static void Main()
      {
      int height = 100;
      var image = new Image { height = height };
      Console.WriteLine("The image's height is {0}.", image.height);
      }
      }

      public class Image
      {
      public int height { get; set; }
      }

      Output: The image's height is 100.


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      C Offline
      C Offline
      Colborne_Greg
      wrote on last edited by
      #85

      damn

      A 1 Reply Last reply
      0
      • C Colborne_Greg

        What problem? People with less skill are more focused on getting the job done, then writing cool useless code.

        OriginalGriffO Offline
        OriginalGriffO Offline
        OriginalGriff
        wrote on last edited by
        #86

        The problem is that "people with less skill" assume that a "ooh shiny" language feature is cool at all. With is a PITA - it doesn't improve readability, it obfuscates it slightly and just makes it slightly shorter to type.

        Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)

        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
        "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

        C 1 Reply Last reply
        0
        • P PIEBALDconsult

          That's what makes C# better than VB. :-D Try writing an event that returns a value in VB. :cool:

          You'll never get very far if all you do is follow instructions.

          J Offline
          J Offline
          Jorgen Andersson
          wrote on last edited by
          #87

          What's the problem?

          Wrong is evil and must be defeated. - Jeff Ello[^]

          1 Reply Last reply
          0
          • P PIEBALDconsult

            What about that can't be done in C#? :confused:

            You'll never get very far if all you do is follow instructions.

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #88
                   Catch
                    End Try
                Next
            Catch
            End Try
            

            End Sub

            A rat's tail of different closing elements instead of some simple closing brackets.

            The language is JavaScript. that of Mordor, which I will not utter here
            I hold an A-7 computer expert classification, Commodore. I'm well acquainted with Dr. Daystrom's theories and discoveries. The basic design of all our ship's computers are JavaScript.

            C F 2 Replies Last reply
            0
            • C Colborne_Greg

              I think that Visual Basic should be shown off for its beauty and elegance. Here is a sample of what it can do - that no other language can do:

              Private Sub AlbumListPopulate()
              Try
              AlbumsList.ItemsSource = New List(Of Image)

                  For Each AlbumName In Pictures.Albums
                      Try
                          AlbumsList.ItemsSource.Add \_
                              (
                                  New Image With
                                  {
                                      .Height = 150,
                                      .Width = 150,
                                      .Source = RotateStream \_
                                      (
                                          Pictures.Album(AlbumName).Picture,
                                          Pictures.Album(AlbumName).Angle
                                      )
                                  }
                              )
                      Catch
                      End Try
                  Next
              Catch
              End Try
              

              End Sub

              P Offline
              P Offline
              PIEBALDconsult
              wrote on last edited by
              #89

              Actually it just got a lot more credit... Swift is Apple's version of VB. :-D

              You'll never get very far if all you do is follow instructions.

              C 1 Reply Last reply
              0
              • OriginalGriffO OriginalGriff

                The problem is that "people with less skill" assume that a "ooh shiny" language feature is cool at all. With is a PITA - it doesn't improve readability, it obfuscates it slightly and just makes it slightly shorter to type.

                Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)

                C Offline
                C Offline
                Colborne_Greg
                wrote on last edited by
                #90

                My employee cost vs performance says otherwise

                D 1 Reply Last reply
                0
                • P PIEBALDconsult

                  Yes. And I really don't like that Extension Methods require the using directive. Very powerful are aliases though. Recently I used an alias to resolve a namespace conflict, rather than have globall:: scattered throughout some code:

                  namespace PIEBALD.Data.MySql
                  {
                  using MySqlClient=global::MySql.Data.MySqlClient ;

                  public sealed class DatabaseInfo : PIEBALD.Data.DatabaseInfo<MySqlClient.MySqlDbType>

                  You'll never get very far if all you do is follow instructions.

                  C Offline
                  C Offline
                  Colborne_Greg
                  wrote on last edited by
                  #91

                  Thank God I don't need SQL anymore. I use Unidex which I wrote in Visual basic ;)

                  1 Reply Last reply
                  0
                  • P PIEBALDconsult

                    Actually it just got a lot more credit... Swift is Apple's version of VB. :-D

                    You'll never get very far if all you do is follow instructions.

                    C Offline
                    C Offline
                    Colborne_Greg
                    wrote on last edited by
                    #92

                    Swift looks like C# almost exactly

                    P 1 Reply Last reply
                    0
                    • C Colborne_Greg

                      Swift looks like C# almost exactly

                      P Offline
                      P Offline
                      PIEBALDconsult
                      wrote on last edited by
                      #93

                      Of course my comment is tongue-in-cheek, but you must not have looked at Swift hard enough yet.

                      You'll never get very far if all you do is follow instructions.

                      C 1 Reply Last reply
                      0
                      • L Lost User
                               Catch
                                End Try
                            Next
                        Catch
                        End Try
                        

                        End Sub

                        A rat's tail of different closing elements instead of some simple closing brackets.

                        The language is JavaScript. that of Mordor, which I will not utter here
                        I hold an A-7 computer expert classification, Commodore. I'm well acquainted with Dr. Daystrom's theories and discoveries. The basic design of all our ship's computers are JavaScript.

                        C Offline
                        C Offline
                        Colborne_Greg
                        wrote on last edited by
                        #94

                        Visual basic does not have the closing bracket issue that C# has. It makes it easier for people that have less or no skill to be more productive, oh look win for VB.

                        L 1 Reply Last reply
                        0
                        • P PIEBALDconsult

                          Of course my comment is tongue-in-cheek, but you must not have looked at Swift hard enough yet.

                          You'll never get very far if all you do is follow instructions.

                          C Offline
                          C Offline
                          Colborne_Greg
                          wrote on last edited by
                          #95

                          No I haven't, I've only seen declaring memory and other basic functions which all were the exact same as C#

                          1 Reply Last reply
                          0
                          • C Colborne_Greg

                            Most of that code is autocompleted also the inside catch is to ensure the loop continues

                            L Offline
                            L Offline
                            Lost User
                            wrote on last edited by
                            #96

                            Colborne_Greg wrote:

                            also the inside catch is to ensure the loop continues

                            Now you're swallowing 10.000 exceptions in a loop :laugh: After that a "File Saved Succesfull" dialog and pretend nothing ever happened.

                            Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

                            C L 2 Replies Last reply
                            0
                            • L Lost User

                              Colborne_Greg wrote:

                              also the inside catch is to ensure the loop continues

                              Now you're swallowing 10.000 exceptions in a loop :laugh: After that a "File Saved Succesfull" dialog and pretend nothing ever happened.

                              Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

                              C Offline
                              C Offline
                              Colborne_Greg
                              wrote on last edited by
                              #97

                              No the problem is when one error exists it kills the loop half way through, this code is only run to display results on the GUI, so not only do I not want it to fail for one error, I don't want it to waste time trying to figure out anything related to that error. I am only unidex the only errors that get through to a client are typos, such as bad filenames

                              L 1 Reply Last reply
                              0
                              • C Colborne_Greg

                                Visual basic does not have the closing bracket issue that C# has. It makes it easier for people that have less or no skill to be more productive, oh look win for VB.

                                L Offline
                                L Offline
                                Lost User
                                wrote on last edited by
                                #98

                                Colborne_Greg wrote:

                                It makes it easier for people that have less or no skill to be more productive

                                And that's exactly what raises my expectations whenever someone comes with VB.

                                The language is JavaScript. that of Mordor, which I will not utter here
                                I hold an A-7 computer expert classification, Commodore. I'm well acquainted with Dr. Daystrom's theories and discoveries. The basic design of all our ship's computers are JavaScript.

                                C 1 Reply Last reply
                                0
                                • L Lost User

                                  Colborne_Greg wrote:

                                  also the inside catch is to ensure the loop continues

                                  Now you're swallowing 10.000 exceptions in a loop :laugh: After that a "File Saved Succesfull" dialog and pretend nothing ever happened.

                                  Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

                                  L Offline
                                  L Offline
                                  Lost User
                                  wrote on last edited by
                                  #99

                                  How often I have seen something like that. And then the criminal who wrote this thinks he's being treated unjustly and exclaims something like "But it always has worked!". And then try to explain to Mr. Pointy Hair that this mess only pretended to work at best, fell flat on its face and was more busy covering it up than anything else at worst, and that looking away will not solve anything or save us one single cent.

                                  The language is JavaScript. that of Mordor, which I will not utter here
                                  I hold an A-7 computer expert classification, Commodore. I'm well acquainted with Dr. Daystrom's theories and discoveries. The basic design of all our ship's computers are JavaScript.

                                  C R 2 Replies Last reply
                                  0
                                  • C Colborne_Greg

                                    If pictures is null the memory space creates itself and returns a empty album list

                                    M Offline
                                    M Offline
                                    Mycroft Holmes
                                    wrote on last edited by
                                    #100

                                    I think he is referring to the empty catch, it was my first thought. Oh a new version of resume next :laugh:

                                    Never underestimate the power of human stupidity RAH

                                    C 1 Reply Last reply
                                    0
                                    • C Colborne_Greg

                                      So now instead of with I need this. And I would have to write this over and over and over

                                      P Offline
                                      P Offline
                                      PIEBALDconsult
                                      wrote on last edited by
                                      #101

                                      Colborne_Greg wrote:

                                      I need this

                                      Probably not.

                                      You'll never get very far if all you do is follow instructions.

                                      1 Reply Last reply
                                      0
                                      • S Simon_Whale

                                        No as you would of written it like this VB.NET Version

                                        New image With
                                        {
                                        .height = height
                                        }

                                        C# Version, in the C# version the With Keyword is ommited

                                        new image { height = this.height }

                                        Every day, thousands of innocent plants are killed by vegetarians. Help end the violence EAT BACON

                                        P Offline
                                        P Offline
                                        PIEBALDconsult
                                        wrote on last edited by
                                        #102

                                        Simon_Whale wrote:

                                        would of have

                                        FTFY new image**()** { Height = Height } In one small test, I see that the this. isn't required, but it seems to confuse the debugger a bit. I prefer to use this. just because.

                                        You'll never get very far if all you do is follow instructions.

                                        1 Reply Last reply
                                        0
                                        • M Mycroft Holmes

                                          I think he is referring to the empty catch, it was my first thought. Oh a new version of resume next :laugh:

                                          Never underestimate the power of human stupidity RAH

                                          C Offline
                                          C Offline
                                          Colborne_Greg
                                          wrote on last edited by
                                          #103

                                          He asked what if pictures were null. It's actually a shared class, and this procedure is only for displaying what is in the system.

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups