Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VS 2022, BC30456 'Join' is not a member of Path - ?!

Status
Not open for further replies.

IlyaRabyy

Programmer
Nov 9, 2010
568
US
Colleagues,
Whatever new product MS releases - it's usually quite buggy/fleassy/roachy/whateverUcallit, but it has never happened with Visual Studio that what worked in previous version doesn't wanna work in the next version!
But here it is:

2024-01-12_JoinNotMemberOfPathVS2022Win11_h2p5by.jpg


Whereas the VS documentation says:

2024-01-12_JoinNotMemberOfPathVS2022Win11_Help_jbmkzw.jpg


Here's the link:
Any ideas how to circumvent this VS's discrepancy?

Just in case, here's the function's full code (and note this persisting autoindentation, BTW):

Code:
======================================================================================================================
Public Function AddBackSlash(ByVal tsPath As String) As String
	'===================================================================================================================================
	' Purpose       : Ensures the given path string has backslash at the end.
	' Description   : Checks if the passed parameter's data type match those of the Function's argument; if not – throws error message 
	'                 and returns unchanged parameter.
	'                 Checks if it's an empty string, if it is - returns it As-Is.
	'                 Checks if it's only a file name, if it is - returns it As-Is.
	'                 Checks the given parameter-string in case it's full path to a file, cuts off the file name if it is.
	'                 Checks if the given parameter-string has backslash at the end, adds it if it has not.
	' Parameters    : Path as String - mandatory
	' Returns       : Path with the backslash at the end, as String.
	' Side effects  : None.
	' Notes         : 1. Generic, applies with .NET Framework ver. 1.1, .NET Core 1.0, .NET Standard 1.0 and higher.
	'                 2. Verbose on errors, silent otherwise.
	'===================================================================================================================================
	Dim lsMsg As String = "", lsRet As String = "" 'lsPath As String = "", 

	' Parameter's verification
	If VarType(tsPath) <> VariantType.String Then
		lsMsg = "Invalid parameter passed: " & Chr(34) & "tsPath" & Chr(34) & " must be of type String!"
		MsgBox(lsMsg, MsgBoxStyle.Critical, "Fatal Error: INVALID PARAMETER")
		Return lsRet
	End If

	If String.IsNullOrEmpty(tsPath) Then
		Return lsRet
	End If

	
	lsRet = System.IO.Path.Join(tsPath, ".").TrimEnd(".")
	
	Return lsRet
End Function
'===================================================================================================================================

Regards,

Ilya
 


Path.Combine() if you are working in the .Net Framework or .Net Standard 2.0 and below. Join was added to .Net Standard 2.1. The documentation page you show has .Net 8 as the Version number reference.





Mark

"You guys pair up in groups of three, then line up in a circle."
- Bill Peterson, a Florida State football coach
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top