Click here to Skip to main content
15,897,891 members
Home / Discussions / C#
   

C#

 
GeneralRe: Kill a process Pin
krishna194-May-06 20:28
krishna194-May-06 20:28 
GeneralRe: Kill a process Pin
A.Gharighi6-May-06 3:00
A.Gharighi6-May-06 3:00 
GeneralRe: Kill a process Pin
krishna199-May-06 0:03
krishna199-May-06 0:03 
QuestionHow to change the DNS HostName using WMI Pin
Sharanray4-May-06 2:40
Sharanray4-May-06 2:40 
QuestionHow to process web page that is on different we bserver Pin
rohan19814-May-06 2:36
rohan19814-May-06 2:36 
QuestionDifferent string conversions to integer Pin
Brendan Vogt4-May-06 2:28
Brendan Vogt4-May-06 2:28 
AnswerRe: Different string conversions to integer Pin
Guffa4-May-06 3:39
Guffa4-May-06 3:39 
AnswerRe: Different string conversions to integer Pin
J4amieC4-May-06 3:43
J4amieC4-May-06 3:43 
Interesting question, and not really one answer, as you have asked about things which look similar but in some cases are not!

Ill try to address some of your queries.

Int32.Parse - most non-string datatypes in .NET provide an easy way to convert to that datatype from a string - mainly for convenience as programmers often use string representations. DateTime.Parse, Int16.Parse immediately come to mind.

Convert - this is a convenient helper class that knows how to do many conversions to and from every base type. However, it is just a wrapper around the actual casting & converting which can be done. For example, decompile the Convert.ToInt32(string) method and you get:
public static int ToInt32(string value)
{
      if (value == null)
      {
            return 0;
      }
      return int.Parse(value);
}

so, in essence Convert.ToInt32(String) is just using int32.Parse under the hood.

SqlDataReader.GetInt32 - This is a type-safety convenience. Rather than have to convert each read column to its a desired type, the data reader provides a type-safe way of reading each value. Without this convenience, you would have alot of this in your code

int myIntValue = (int)myDataReader["MyIntColumn"];

You should also read up on the difference between casting from one type to another, and parsing a string to a different type - that will help you understand a little more.

Hope that helps.


Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour

AnswerRe: Crystal report Pin
V.4-May-06 3:30
professionalV.4-May-06 3:30 
QuestionRemove cache programmatically Pin
AmitSumit4-May-06 1:45
AmitSumit4-May-06 1:45 
AnswerRe: Remove cache programmatically Pin
Guffa4-May-06 4:19
Guffa4-May-06 4:19 
QuestionXML Data Binding Pin
Kyawgyi4-May-06 1:17
Kyawgyi4-May-06 1:17 
AnswerRe: XML Data Binding Pin
sathish s4-May-06 1:24
sathish s4-May-06 1:24 
QuestionCasting string to Date Pin
Mark064-May-06 1:11
Mark064-May-06 1:11 
AnswerRe: Casting string to Date Pin
sathish s4-May-06 1:22
sathish s4-May-06 1:22 
GeneralRe: Casting string to Date Pin
Mark064-May-06 1:46
Mark064-May-06 1:46 
AnswerRe: Casting string to Date Pin
alexey N4-May-06 1:23
alexey N4-May-06 1:23 
QuestionDataGridColumnStyle in WinForms Pin
Sreeroop4-May-06 0:36
Sreeroop4-May-06 0:36 
AnswerRe: DataGridColumnStyle in WinForms Pin
MCSD-Gandalf4-May-06 2:26
MCSD-Gandalf4-May-06 2:26 
GeneralRe: DataGridColumnStyle in WinForms Pin
Sreeroop4-May-06 20:48
Sreeroop4-May-06 20:48 
QuestionHow to run application from Byte[] Pin
Dima Filipiuk4-May-06 0:27
Dima Filipiuk4-May-06 0:27 
AnswerRe: How to run application from Byte[] Pin
alexey N4-May-06 0:35
alexey N4-May-06 0:35 
Questionhow to Save Matrix Pin
Greeky4-May-06 0:19
Greeky4-May-06 0:19 
AnswerRe: how to Save Matrix Pin
Guffa4-May-06 1:09
Guffa4-May-06 1:09 
GeneralRe: how to Save Matrix Pin
Greeky4-May-06 1:37
Greeky4-May-06 1:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.