|
I was hoping to avoid low-level coding in C#, but I will take a look at the article. Thanks.
|
|
|
|
|
.Net does not has native support for this (but you could build your own component using sockets and others *low* level components), as others have said, exists third party components that will do this for you, one of them is:
http://www.chilkatsoft.com/Email-DotNet.asp[^]
Hope this helps.
|
|
|
|
|
Thanks, I will take a look.
|
|
|
|
|
Hello,
I'm trying to read a RSS from within a C# code like this (I found this example on the internet):
XmlTextReader rssReader;
XmlDocument rssDoc;
XmlNode nodeRss=null;
rssReader = new XmlTextReader( *** URL *** );
rssDoc = new XmlDocument();
rssDoc.Load(rssReader);
for (int i = 0; i < rssDoc.ChildNodes.Count; i++)
if (rssDoc.ChildNodes[i].Name == "rss")
for (int ii = 0; ii < nodeRss.ChildNodes.Count; ii++)
if (nodeRss.ChildNodes[ii].Name == "channel")
nodeChannel = nodeRss.ChildNodes[ii];
This works fine for most of the RSS I tried. But it doesn't work with this one:
http://www.klack.de/include/generateRSS.php?TYPE=TVPLANER&ID=d7fdb37979873520025e66554beb532d3065904
I get an exception on "rssDoc.Load(rssReader);": The main element is not available. (translated from german).
Does anybody know how I can fix or get around this ?
Thanks !
Georg
|
|
|
|
|
There is no RSS feed at that link?
|
|
|
|
|
well, yes there is - at least FireFox can handle it as a RSS feed.
|
|
|
|
|
No, there isn't. I get a response with the length zero:
Date: Fri, 13 Feb 2009 01:37:56 GMT
Server: Apache/2.2.3 (Debian) PHP/5.2.0-8+etch11
X-Powered-By: PHP/5.2.0-8+etch11
Content-Length: 0
Content-Type: text/html; charset=UTF-8
Via: 1.1 www.klack.de
Keep-Alive: timeout=15, max=500
Connection: Keep-Alive
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
|
I tried "RSS 2.0 Framework" but it gets into the same trouble. That's why
I tried to run something more simple - with the same result.
|
|
|
|
|
I was told that the most common method to convert a value is to use the Parse method, however it only works with strings, as you all know...
So I was wondering, then: if you're converting a non-string value to another non-string, is it better/more efficient to use for example...
Convert.ToInt32(value);
or
int.Parse(value.ToString());
Thanks guys!
|
|
|
|
|
Hi,
it depends on the Type of your value:
if value is a string, then value.ToString() is redundant, and both Convert and int.Parse would behave identically (in fact one is calling the other).
if value is some kind of integer to begin with, Convert.ToInt32() is much faster, since no conversion from integer to string, and no conversion from string to int are involved.
if value is something else (a DateTime, a user-defined type, ...) Convert will not accept it,
whereas the value.ToString() result may or may not look like an integer, and be acceptable to int.Parse
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Sunday, June 12, 2011 8:02 AM
|
|
|
|
|
Luc summed it up well, but I just wanted to add one other non-obvious difference.
With value = null;
Convert.ToInt32(value) returns 0
int.Parse(value.ToString()) throws NullReferenceException.
int.Parse(value) throws ArgumentNullException. (if value is String)
|
|
|
|
|
hi,
look at the int.TryParse(object,out bool) functionality.
The boolean value stands up for true (parseable) and false(not parseable) about trying to parse the value. There will be no exception raised. if you want to use int.Parse instead of TryParse you need to catch the exception with try catch..
bless
|
|
|
|
|
In my opinion the only worthwhile member of Convert is System.Convert.ChangeType , will that do what you want?
Otherwise, maybe a simple cast is what you want?
Or, if it's a type of your own creation, perhaps an implicit conversion operator?
You would have to give us more information.
|
|
|
|
|
Hijack
If you have 2 classes that are identical (set of credentials) can you use System.Convert.ChangeType to convert one to the other?
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
The most common method to convert a non-string value to an int is implicit or explicit casting. Example:
byte b = 42;
int answer = b;
double d = 42.0;
int answer = (int)d;
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I have an ASP file and a Customer class both in the same namespace. When I compile I receive the error: The type or namespace name 'Customer' could not be found (are you missing a using directive or an assembly reference?). I have checked and the asp page
Inherits="PopupApplication.InitDialog"
And the Customer was created in that namespace and has that namespace in the class file. Can anyone help?
Thanks,
Steve
|
|
|
|
|
Make sure your class is decorated with "public".
Also, you may try to move it in App_Code folder.
Calin
|
|
|
|
|
is there is any free pivot chart Controller for visual studio
Dushan Perera
|
|
|
|
|
Hi Team,
Required functional is to access the Base class Method itself on other hierarchy class but need to restrict the base class method on derive class.
For Example,
Base Class B --------> Having Static Method M
Derive D from B
Need to restrict the access of Method M through D but should be accessible through B.
Can anybody help me out.
Thanks in Advance
Tarun Singh
|
|
|
|
|
maybe use the sealed keyword, im not sure thou
no, dont think so lol... try 'explicit' keyword instead
If only MySelf.Visible was more than just a getter...
A person can produce over 5 times there own body weight in excrement each year... please re-read your questions before posting
|
|
|
|
|
explicit is for overloading conversion operators.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
No, Not Fulfill the functionality.
|
|
|
|
|
Not sure you can.
The best I can think of is to mark D's M as internal new , that way it won't be visible outside that particular assembly but B's M will.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
One way I can see doing this is by adding a level of hierarchy,
Base Class B
Derived Class B_With_M
Derived Class D
All other classes whom you want to give access to M will derive from B_With_M and not from B.
|
|
|
|