开发者

What does "R"c mean when mapping a network drive using this function

I copied code to map a network drive from http://www.vbforums.com/showthread.php?t=616519 to map the drive and http://cjwdev.wordpress.com/2010/05/30/delete-开发者_开发知识库network-drive/ to delete the drive. I want to know what "R"c means in this code:

    RemoveNetworkDrive("R"c, True)

which came from the first link and then I want to know how to simulate this notation in a variable so I can check for the first available drive and map the network drive to that letter. I would Google search it but since I don't know what "R"c means it makes it difficult.


"R"c is the Char version of "R". You use it when you want to specify a character rather than a string.

MSDN has some details here:

You can also create an array of strings from a single string by using the String.Split Method. The following example demonstrates the reverse of the previous example: it takes a shopping list and turns it into an array of shopping items. The separator in this case is an instance of the Char data type; thus it is appended with the literal type character c.

Dim shoppingList As String = "Milk,Eggs,Bread"
Dim shoppingItem(2) As String
shoppingItem = shoppingList.Split(","c)


It converts your string "R" to a char, as requested from function

Public Shared Sub RemoveNetworkDrive(ByVal DriveLetter As Char, ...)


It's the syntax for a character literal, basically - it's the equivalent of 'R' in C#, if that makes it any clearer.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜