ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT

VB.Net program to demonstrate the un-boxing

Here, we are going to demonstrate the un-boxing in VB.Net.
Submitted by Nidhi, on December 20, 2020

Here, we will create a variable of object type and then perform un-boxing by assigning the value of the object to the integer variable after converting from Cint() function.

Program/Source Code:

The source code to demonstrate the un-boxing is given below. The given program is compiled and executed successfully.

'VB.Net program to demonstrate the un-boxing.

Module Module1
    Sub Main()

        Dim val As Integer
        Dim obj As Object = 10

        val = CInt(obj)
        Console.WriteLine("value of val : " & val)
    End Sub
End Module

Output:

value of val : 10
Press any key to continue . . .

Explanation:

In the above program, we created a module Module1 that contains a Main() subroutine.

The Main() subroutine is the entry point for the program. Here, we created a variable obj of object type and then perform un-boxing by assigning the value of an object to the integer variable after converting from Cint() function, and that on the console screen.

VB.Net Basic Programs »



ADVERTISEMENT



ADVERTISEMENT



Comments and Discussions

ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.