VS & quot; 15 & quot; preview the new functions of VB 15 in 5, vsvb

Source: Internet
Author: User

VS "15" preview 5 new functions of VB 15, vsvb

VS "15" preview 5 updates VB.
This update contains three content:


*ValueTuple
This function can return a group of computing results.
To use this function, we need to install the System. ValueTuple package. This is a test package, and I have carefully tested the value tuples of C.
After being installed, define a simple function

VB

Function TupleTest() As (Integer, b As String)  Return (1, 2)End Function


The return value of this function contains two private fields and three public attributes.
The Member is used to put these two values. The attributes are
Item1, Item2, B
Here, B and Item2 point to the same field.
This is because the first member has no name and the default name is item1. The second parameter has the name B.
As for Item2, this may be a Bug, or it may have been designed to have a default name for each member in some anonymous tuples.
Currently, the value tuples do not support deconstruct or Option Explicit Off.


*Binary Number and digit Separator
Now we can use & B to define a binary number. For example:

VB

Enum MouseState  None = &B0  Left = &B1  Right = &B10  Middle = &B100  X1 = &B1000  X2 = &B1_0000End Enum


Is it convenient?


*The ByRef return type is supported.
In C #, you can define a method or attribute for returning ref. Now VB can use this method normally. For example:

C #

public ref double Items(int index){  return ref this._collection[index];}


Use code in VB

VB

Items(0)=2.5


The first element of _ collection can be changed to 2.5 normally.

I personally think this function is only used for code compatible with c #7.0. This is because this function is somewhat difficult to write as an equivalent alternative. You can retrieve the value and copy it back without creating a reference.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.