Results 1 to 5 of 5

Thread: *resolved* '= 'not supported for structures

  1. #1

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    *resolved* '= 'not supported for structures

    well, structures are value types but the '=' opperator isnt supported for them.... I tried the Equals method and sounds like it works. Is that the best way to compare variables of structures?
    Last edited by MrPolite; Aug 18th, 2002 at 10:25 PM.
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  2. #2
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    In C# you can overload operators which would do what you want, but VB you can't. You are going to have to probably go the other route if you do the structure in VB.

  3. #3

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    umm, I dont even know why "=" isnt supported for them so basically the Equals() function is the correct way for this, right?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  4. #4
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Even when you compair two types like integers, it is overloading the = operator. When someone designed the integer class, they overloaded the = operator so when you compair two integers, it compairs the values that the class holds. If they didn't do this, then you would only be compairing two instances of the integer class. If those two variables didn't point to the same object, then they wouldn't be equal.

    What I would do if I were you is create the structure in C#. Overload the = operator, then in VB when you create the instances of the struct, you could compair them with the = operator like you want to do.

  5. #5

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    Originally posted by hellswraith
    Even when you compair two types like integers, it is overloading the = operator. When someone designed the integer class, they overloaded the = operator so when you compair two integers, it compairs the values that the class holds. If they didn't do this, then you would only be compairing two instances of the integer class. If those two variables didn't point to the same object, then they wouldn't be equal.

    What I would do if I were you is create the structure in C#. Overload the = operator, then in VB when you create the instances of the struct, you could compair them with the = operator like you want to do.
    I'll put that in the list so whenever I learn C# I would be able to do it
    thanks for the info
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width