PC Review


Reply
Thread Tools Rate Thread

C# equivelant of VB.NET's Asc()

 
 
Nathan Sokalski
Guest
Posts: n/a
 
      28th Jun 2008
VB.NET has a function, Asc(), that gets the Ascii value of a character. I am
attempting to find an equivelant function for C#. Can somebody help me here?
--
Nathan Sokalski
(E-Mail Removed)
http://www.nathansokalski.com/


 
Reply With Quote
 
 
 
 
Arne Vajhøj
Guest
Posts: n/a
 
      28th Jun 2008
Nathan Sokalski wrote:
> VB.NET has a function, Asc(), that gets the Ascii value of a character. I am
> attempting to find an equivelant function for C#. Can somebody help me here?


(int)c

Arne

PS: I believe Asc is a VB6'ism.
 
Reply With Quote
 
Mr. Arnold
Guest
Posts: n/a
 
      28th Jun 2008

"Arne Vajhøj" <(E-Mail Removed)> wrote in message
news:48659a67$0$90274$(E-Mail Removed)...
> Nathan Sokalski wrote:
>> VB.NET has a function, Asc(), that gets the Ascii value of a character. I
>> am attempting to find an equivelant function for C#. Can somebody help me
>> here?

>
> (int)c
>
> Arne
>
> PS: I believe Asc is a VB6'ism.


Asc() can still be used VB.Net. It was in VB3-VB6 and QuickBasic too.

 
Reply With Quote
 
Fred
Guest
Posts: n/a
 
      28th Jun 2008
Dans : news:(E-Mail Removed),
Mr. Arnold écrivait :
> "Arne Vajhøj" <(E-Mail Removed)> wrote in message
> news:48659a67$0$90274$(E-Mail Removed)...
>> Nathan Sokalski wrote:
>>> VB.NET has a function, Asc(), that gets the Ascii value of a
>>> character. I am attempting to find an equivelant function for C#.
>>> Can somebody help me here?

>>
>> (int)c
>>
>> Arne
>>
>> PS: I believe Asc is a VB6'ism.

>
> Asc() can still be used VB.Net. It was in VB3-VB6 and QuickBasic too.


But it's not equivalent to Arne's solution as it returns windows default
encoding character code (not Unicode value)

--
Fred
(E-Mail Removed)

 
Reply With Quote
 
Fred
Guest
Posts: n/a
 
      28th Jun 2008
Dans : news:(E-Mail Removed),
Fred écrivait :
> Dans : news:(E-Mail Removed),
> Mr. Arnold écrivait :
>> "Arne Vajhøj" <(E-Mail Removed)> wrote in message
>> news:48659a67$0$90274$(E-Mail Removed)...
>>> Nathan Sokalski wrote:
>>>> VB.NET has a function, Asc(), that gets the Ascii value of a
>>>> character. I am attempting to find an equivelant function for C#.
>>>> Can somebody help me here?
>>>
>>> (int)c
>>>
>>> Arne
>>>
>>> PS: I believe Asc is a VB6'ism.

>>
>> Asc() can still be used VB.Net. It was in VB3-VB6 and QuickBasic
>> too.

>
> But it's not equivalent to Arne's solution as it returns windows
> default encoding character code (not Unicode value)


PS : Arne's solution is equivalent to AscW

--
Fred
(E-Mail Removed)

 
Reply With Quote
 
Mr. Arnold
Guest
Posts: n/a
 
      28th Jun 2008

"Fred" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Dans : news:(E-Mail Removed),
> Mr. Arnold écrivait :
>> "Arne Vajhøj" <(E-Mail Removed)> wrote in message
>> news:48659a67$0$90274$(E-Mail Removed)...
>>> Nathan Sokalski wrote:
>>>> VB.NET has a function, Asc(), that gets the Ascii value of a
>>>> character. I am attempting to find an equivelant function for C#.
>>>> Can somebody help me here?
>>>
>>> (int)c
>>>
>>> Arne
>>>
>>> PS: I believe Asc is a VB6'ism.

>>
>> Asc() can still be used VB.Net. It was in VB3-VB6 and QuickBasic too.

>
> But it's not equivalent to Arne's solution as it returns windows default
> encoding character code (not Unicode value)
>


What does that have to do with anything? It's not a VB6'ism is all that was
being pointed out here and nothing else.

 
Reply With Quote
 
Mr. Arnold
Guest
Posts: n/a
 
      28th Jun 2008

"Fred" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...

<snipped>

Yeah -- yeah don't be going off the deep-end with this.

 
Reply With Quote
 
Fred
Guest
Posts: n/a
 
      28th Jun 2008
Dans : news:%(E-Mail Removed),
Mr. Arnold écrivait :
> "Fred" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Dans : news:(E-Mail Removed),
>> Mr. Arnold écrivait :
>>> "Arne Vajhøj" <(E-Mail Removed)> wrote in message
>>> news:48659a67$0$90274$(E-Mail Removed)...
>>>> Nathan Sokalski wrote:
>>>>> VB.NET has a function, Asc(), that gets the Ascii value of a
>>>>> character. I am attempting to find an equivelant function for C#.
>>>>> Can somebody help me here?
>>>>
>>>> (int)c
>>>>
>>>> Arne
>>>>
>>>> PS: I believe Asc is a VB6'ism.
>>>
>>> Asc() can still be used VB.Net. It was in VB3-VB6 and QuickBasic
>>> too.

>>
>> But it's not equivalent to Arne's solution as it returns windows
>> default encoding character code (not Unicode value)
>>

>
> What does that have to do with anything? It's not a VB6'ism is all
> that was being pointed out here and nothing else.


I probably misunderstood as english is not my native language. I just
wanted Nathan to know he can get some different results with (int)c that
he used to get with Asc.
I am sorry to disturb.

--
Fred
(E-Mail Removed)

 
Reply With Quote
 
Michel Posseth [MCP]
Guest
Posts: n/a
 
      28th Jun 2008
'"I believe Asc is a VB6'ism"

It would have been if you needed to set a reference to the
Microsoft.VisualBasic.Compatibility namespace
(Microsoft.VisualBasic.Compatiblity.dll)
please note that if you do not need to set this reference you are working
with the Microsoft.VisualBasic namespace wich is for current Visual Basic
..NET programs , it is a mamanged library that is part of the framework just
as system.data for instance, It is even possible to set a reference to the
VB namespace in C# and thus use all the VB shortcut methods in C#

hth

Michel Posseth
..



"Arne Vajhøj" <(E-Mail Removed)> schreef in bericht
news:48659a67$0$90274$(E-Mail Removed)...
> Nathan Sokalski wrote:
>> VB.NET has a function, Asc(), that gets the Ascii value of a character. I
>> am attempting to find an equivelant function for C#. Can somebody help me
>> here?

>
> (int)c
>
> Arne
>
> PS: I believe Asc is a VB6'ism.



 
Reply With Quote
 
Cor Ligthert[MVP]
Guest
Posts: n/a
 
      28th Jun 2008
Nathan-

\\\
int a = Convert.ToInt32('A');
int b = 'A';
///

-Cor

"Nathan Sokalski" <(E-Mail Removed)> schreef in bericht
news:%(E-Mail Removed)...
> VB.NET has a function, Asc(), that gets the Ascii value of a character. I
> am attempting to find an equivelant function for C#. Can somebody help me
> here?
> --
> Nathan Sokalski
> (E-Mail Removed)
> http://www.nathansokalski.com/
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
C# equivelant of VB.NET's Asc() Nathan Sokalski Microsoft Dot NET Framework 55 10th Mar 2010 01:24 PM
C# equivelant of VB.NET's Asc() Nathan Sokalski Microsoft VB .NET 53 7th Jul 2008 07:30 AM
C# equivelant of vb6 app.name Tim Kelley Microsoft C# .NET 1 17th Aug 2006 05:06 PM
Equivelant With - End with =?Utf-8?B?QW50?= Microsoft C# .NET 3 26th Jun 2005 11:39 PM
(a != b) equivelant to !(a == b)? Daniel Billingsley Microsoft C# .NET 10 27th Oct 2003 12:47 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:35 AM.