473,698 Members | 2,132 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

The @ symbol

hello,

What does the "@" symbol do in the following line of code? I tried
searching the web but searching for "@ and c#" seems to be a waste of
time :)

FileInfo fi = new FileInfo(di.Ful lName + @"\myxmlfile.xm l");

Thanks,
-J

Feb 15 '06 #1
7 1286
>FileInfo fi = new FileInfo(di.Ful lName + @"\myxmlfile.xm l");

It makes it a verbatim string literal where \ isn't treated as an
escape character. It's equivalent to the regular string
"\\myxmlfile.xm l".

You may also want to consider calling System.IO.Path. Combine instead
of doing straight string concatenation.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Feb 15 '06 #2
It indicates that the string should be taken as-is: the backslash in
this case is _not_ an escape character. It's meant to make writing
Windows / DOS pathnames easier. Rather than having to write this:

FileInfo fi = new FileInfo(di.Ful lName + "\\myxmlfile.xm l");

so that the \\ resolves into a single \, you can specify no escapes:

FileInfo fi = new FileInfo(di.Ful lName + @"\myxmlfile.xm l");

so here the compiler doesn't attempt to resolve "\m" into a special
character. This can be very handy if you're using UNC names:

string myPath = @"\\unix1\tiffs \product\4x4\M0 356A.tif";

instead of (yuck):

string myPath = "\\\\unix1\\tif fs\\product\\4x 4\\M0356A.tif";

Feb 15 '06 #3
<kn*********@gm ail.com> wrote:
What does the "@" symbol do in the following line of code? I tried
searching the web but searching for "@ and c#" seems to be a waste of
time :)

FileInfo fi = new FileInfo(di.Ful lName + @"\myxmlfile.xm l");


See http://www.pobox.com/~skeet/csharp/s....html#literals

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Feb 15 '06 #4
In addition to what others have said it can also be used on identifiers
to allow language keywords as names. It's not something you see very
often though. For example, a VB.NET developer could decide that the
identifier "sealed" would be a good name for a property not knowing
that it is a keyword in C#. A C# developer using the VB.NET code would
need to qualify it with an @.

Brian

kn*********@gma il.com wrote:
hello,

What does the "@" symbol do in the following line of code? I tried
searching the web but searching for "@ and c#" seems to be a waste of
time :)

FileInfo fi = new FileInfo(di.Ful lName + @"\myxmlfile.xm l");

Thanks,
-J


Feb 15 '06 #5
Thanks for the info :)

Feb 15 '06 #6
Thanks for the info :)

Feb 15 '06 #7
Brian Gideon <br*********@ya hoo.com> wrote:
In addition to what others have said it can also be used on identifiers
to allow language keywords as names. It's not something you see very
often though. For example, a VB.NET developer could decide that the
identifier "sealed" would be a good name for a property not knowing
that it is a keyword in C#. A C# developer using the VB.NET code would
need to qualify it with an @.


Of course, anyone following the .NET naming conventions would
automatically avoid all C# keywords because all keywords in C# are in
lower-case, and all non-private members in the .NET naming conventions
are PascalCased :)

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Feb 15 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
5860
by: Richard | last post by:
I am setting up HS in 8i, when I go to $ORACLE_HOME/bin and do a ldd hsodbc i get the below error message, I have done a relink to recreate the hsodbc executable but still no luck. I do have a tar open with oracle but am just curious if anyone has seen this before. Thanks Rich $ ldd hsodbc /usr/lib/libc.2 => /usr/lib/libc.2
0
1687
by: John Graat | last post by:
Hi all, I've built the STLport-462 library on AIX-4.3.3 using gcc-3.3.2. No errors during compilation. However, during linking the following error occurs: ld: 0711-317 ERROR: Undefined symbol: _STL::_Node_Alloc_Lock<(bool)1, (int)0>::_S_lock Besides this error, the following warnings are given: ld: 0711-224 WARNING: Duplicate symbol: _STL::money_get<char,
9
13269
by: Prasad | last post by:
HI, I am a beginner in VC++.. I am trying to write a Win32 console application in visual studio.. I am using following header files.. #include <STRING> using namespace std; #include <hash_map>//from Standard template library //and some other headers
1
4626
by: vsp15584 | last post by:
Hii..i use the coding as below :- import java.applet.applet; import java.awt.*; import com.sun.j3d.utils.applet.mainframe; import com.sun.j3d.utils.universe.*; import com.sun.j3d.utils.geometry.*; import javax.media.j3d.*; import javax.vecmath.*;
2
5324
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: 1>make_buildinfo.obj : error LNK2019: unresolved external symbol __imp__RegQueryValueExA@24 referenced in function _make_buildinfo2 Ask on python-list@python.org . - Josiah
1
5543
by: yamitmehta | last post by:
When I compile to code using g++arm of VxWorks 5.5 and put it on my board i get the follwing undefined symbols:- Cpool and Csingleton are template classes. CPool has the static member variables:-ms_uCapacity ,ms_uAllocatedCount , ms_uLockCapacity ,ms_pmutex -ld < yamit/apps1.out Undefined symbol: _Q23m5tt5CPool1ZQ23m5t10CMarshaler$ms_uCapacity (binding 1 type 0) Undefined symbol: _Q23m5tt5CPool1ZQ23m5t10CMarshaler$ms_uAllocatedCount
6
121907
by: sadegh | last post by:
Hi I have a problem with my program in VC++6 When I compile it, the following errors are listed. I spend a lot of time on the groups.google.com to find its reason, but none of comments could not help me. Does any body know what is the problem?. Thanks. OtherFunctions.obj : error LNK2001: unresolved external symbol "int
2
6653
by: karinmorena | last post by:
I'm having 4 errors, I'm very new at this and I would appreciate your input. The error I get is: Week5MortgageGUI.java:151:cannot find symbol symbol: method allInterest(double,double,double) Location: class Week5MortgageGUI Week5MortgageLogic allint = logic.allInterest(amount, term, rate); Week5MortgageGUI.java:152:cannot find symbol symbol: method allInterest(double,double,double) Location: class Week5MortgageGUI
0
2703
by: Ryan Gaffuri | last post by:
hlink72@hotmail.com (Eric) wrote in message news:<ab8d8b14.0308220550.54fb5f22@posting.google.com>... LNK1120 is a standard C++ error. you using Visual C++? Means your references a class that doesnt exist or something similiar to that. explanation on microsoft.com its not an oracle specific problem.
3
3190
by: Sindhu Rani | last post by:
i hav created 3 classes in 3 different files. am gettin an error durin compilation. wat shud i do??? C:\s\source>javac -d ..\classes devtestdrive.java devtestdrive.java:5: cannot resolve symbol symbol : class device location: class devtestdrive device d1=new tv(); ^ devtestdrive.java:5: cannot resolve symbol symbol : class tv
0
8672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8600
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8892
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8860
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7712
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4361
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2323
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.