A
A
Alexander2016-03-03 15:27:21
C++ / C#
Alexander, 2016-03-03 15:27:21

One backslash in C#?

You need to create JSON and send it to the client, in json there is a path field that should be a trace of the form:
Path1\/Path2", in the C# code I do this: path="Path1\\/Path2" but I get two dashes, I tried to put a dog before the line: @"Path1\/Path2" there were 2 backslashes, how to make one?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Makarov, 2016-03-03
@Nipheris

The second backslash is given to you by the JSON serializer, because backslash is special. character in JSON and must be escaped. If you need something like "\/" in the JSON ITSELF, don't add a backslash to the path at all. The JSON serializer will add it for you when it escapes the FORWARD slash. Those. give the serializer as is, path="Path1/Path2".

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question