Re: vb to c# dll

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hello segue,

In C# (like C++ before it), the \ character is an escape character. In other words, they expect the \ to be followed by another character to tell what character to actually show. For example, I can do this in C#:

string s = "He said, \"Hello THere\"";

The \" tells the string to put an actual quote in my text. One of the most common escape sequences you will see with \ is \\. When you see \\ in your C# code, its the same as seeing \ in your VB.NET code. You can jsut treat it as a single slash. Don't worry about seeing it in the C# code...its normal...don't try and fix it.


Thanks,
Shawn Wildermuth
Speaker, Author and C# MVP
http://adoguy.com

What's a good way to get to these groups dotnet.languages.vb and
csharp, I hate scrolling the udl.

I'd also like to see my references in a folder in the solution
explorer
like I used
to in VS2005. The references are no longer visible for some reason
unless I
use
project references.
Main question:

I'm using a referenced C# .dll in my vb.net project.
I'm trying to pass a string containing a filepath from a vb.net forms
application to a C# dll function. When I step to the C# function my
string
suddenly has extra backslashes. In C# I tried using the replace
function
fileName.Replace("\\", "\");
but I got three errors, 1. newline in constant, ) and ; expected.
Suggestions appreciated.



.



Relevant Pages

  • Re: Escape character treatment in string library functions
    ... '\r' etc special making it difficult to parse even char by char. ... In C, the escape character only affects string literals, i.e. strings ...
    (comp.programming)
  • Re: r - python parser bug?
    ... backslash is an escape character which gives the next ... So '\s' is a two character string. ...
    (comp.lang.python)
  • Re: Anyone know how...
    ... However, the string indexer returns a character, not a string - and ... > You need to use an escape character to look for " characters: ... Very nearly - that's not actually valid C#, as \' isn't a valid escape ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: r - python parser bug?
    ... >> a string literal, it always skips the next character. ... backslash is an escape character which gives the next ...
    (comp.lang.python)
  • Re: XML declaration in DTD System ID? ...
    ... name containing non-ASCII characters? ... Neither general entity references nor numeric character ... references are recognized in declarations in a DTD; ... References (whether entity references or character references) ...
    (comp.text.xml)