confusion with System.dll and mscorlib.dll - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

confusion with System.dll and mscorlib.dll

JapherJapher Posts: 9Member

Both the questions are from "VB.NET"
Q1:

im a bit of a confusion with the "System.dll" and
"mscorlib.dll" files because of the folowing
reason.

Math class is in the "System" namespace and when you
click on the "System" namespace from the solution explorer
it display the assembly of the "System" namespace as System.dll
in the property box.
But according to the MSDN the assembly for "System" namespace
is "mscorlib.dll".

I know the above mention information is bit confusing However
my question is, are these two assemblies(System.dll and mscorlib.dll)
reffers to the mscorlib.dll assembly or they are two different kinds?

--------------------------------------------------------------

Q2:

Module mod1

Dim i As Interger = 7

Sub Main()

in the MessageBox.Show("message" & i, "title")

End Sub

End Module

Does the Show() casts the value of the i to a
string before concatenation?


Comments

  • iwilld0itiwilld0it Posts: 1,134Member
    :
    : Both the questions are from "VB.NET"
    : Q1:
    :
    : im a bit of a confusion with the "System.dll" and
    : "mscorlib.dll" files because of the folowing
    : reason.
    :
    : Math class is in the "System" namespace and when you
    : click on the "System" namespace from the solution explorer
    : it display the assembly of the "System" namespace as System.dll
    : in the property box.
    : But according to the MSDN the assembly for "System" namespace
    : is "mscorlib.dll".
    :
    : I know the above mention information is bit confusing However
    : my question is, are these two assemblies(System.dll and mscorlib.dll)
    : reffers to the mscorlib.dll assembly or they are two different kinds?
    :
    : --------------------------------------------------------------
    :
    : Q2:
    :
    : Module mod1
    :
    : Dim i As Interger = 7
    :
    : Sub Main()
    :
    : in the MessageBox.Show("message" & i, "title")
    :
    : End Sub
    :
    : End Module
    :
    : Does the Show() casts the value of the i to a
    : string before concatenation?
    :
    :
    :

    The mscorlib.dll is the main dll that defines all the base types and then some. System.dll builds on it. Multiple dll's are capable of defining objects that fall under the same namespace. So in many cases, you will find that multiple dll's will make up the definition of a namespace.



  • kainsworthkainsworth Posts: 200Member
    Re your Q2, the variable i remains as an Integer type, even though you have concatenated it into your messagebox string.

    You can test this by inserting a breakpoint immediately after the messagebox code line and checking the Locals Window from the Debug menu.
    You will see that it still appears as an integer with a value of 7.

    If you want to create a string to hold message numbers, (perhaps because you want to compare this string against another one, you can do something like this:
    [code]
    Dim msgnumber As String = CStr("message" & i)
    If msgnumber = "message7" Then
    ' some code here
    End If
    [/code]


  • ItsMeRanganathItsMeRanganath Posts: 3Member
    Hi Japher,
    I have an simple answer to your second question. pardon me if am wrong.

    you are concatenating a string and an integer. the integer will be casted to string in this case.
    [u]proof: [/u]

    If we want to the result of the concatenating ( string + int ) in a variable, then the variable should be of string data type ( it cant be of int datatype ).

    String s = "Record count";
    int i = 10;
    String Count = s + i; // correct
    int Count = s + i; // error

    Hope you understand. Correct me if am wrong.


  • ItsMeRanganathItsMeRanganath Posts: 3Member
    Hi Japher,
    I have an simple answer to your second question. pardon me if am wrong.

    you are concatenating a string and an integer. the integer will be casted to string in this case.
    [u]proof: [/u]

    If we want to the store result of the concatenating ( string + int ) in a variable, then the variable should be of string data type ( it cant be of int datatype ).

    String s = "Record count";
    int i = 10;
    String Count = s + i; // correct
    int Count = s + i; // error

    Hope you understand. Correct me if am wrong.


  • ItsMeRanganathItsMeRanganath Posts: 3Member
    Hi Japher,
    I have an simple answer to your second question. pardon me if am wrong.

    you are concatenating a string and an integer. the integer will be casted to string in this case.
    [u]proof: [/u]

    I am using C# syntax

    If we want to the store result of the concatenation ( string + int ) in a variable, then the variable should be of string data type ( it cant be of int datatype ).

    String s = "Record count";
    int i = 10;
    String Count = s + i; // correct
    int Count = s + i; // error

    Hope you understand. Correct me if am wrong.
Sign In or Register to comment.