Click here to Skip to main content
16,010,523 members
Home / Discussions / C#
   

C#

 
AnswerRe: What's the C# v1 way of doing what a C# Nullable type will do in v2? Pin
leppie2-Feb-05 20:10
leppie2-Feb-05 20:10 
GeneralServices Pin
StephenMcAllister2-Feb-05 13:27
StephenMcAllister2-Feb-05 13:27 
GeneralRe: Services Pin
Robert Rohde2-Feb-05 20:24
Robert Rohde2-Feb-05 20:24 
GeneralRe: Services Pin
Heath Stewart2-Feb-05 23:29
protectorHeath Stewart2-Feb-05 23:29 
GeneralRe: Services Pin
Heath Stewart2-Feb-05 23:39
protectorHeath Stewart2-Feb-05 23:39 
Questionhow can i show the character if a UNICIODE in textbox Pin
mirzaei2-Feb-05 12:11
mirzaei2-Feb-05 12:11 
AnswerRe: how can i show the character if a UNICIODE in textbox Pin
Heath Stewart2-Feb-05 23:49
protectorHeath Stewart2-Feb-05 23:49 
AnswerRe: how can i show the character if a UNICIODE in textbox Pin
Heath Stewart3-Feb-05 0:07
protectorHeath Stewart3-Feb-05 0:07 
If you need to convert a Unicode character to that representation, then it's quite easy. Use UnicodeEncoding.GetBytes to get a byte[] array, then loop over that byte[] array and print either decimal or hexadecimal.

The following example loops in 2-byte increments and prints a decimal format:
using System;
using System.Text;
 
class HtmlEntities
{
  static void Main(string[] args)
  {
    if (args.Length > 0)
    {
      Console.WriteLine(HtmlFormat(args[0]));
    }
  }
 
  static string HtmlFormat(string value)
  {
    StringBuilder sb = new StringBuilder(value.Length * 7);
    Encoding enc = Encoding.Unicode;
 
    foreach (char c in value)
    {
      byte[] buffer = enc.GetBytes(new char[] {c});
      int i = BitConverter.ToInt16(buffer, 0);
      sb.Append("&#" + i.ToString() + ";");
    }
 
    return sb.ToString();
  }
}


This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles] [My Blog]
GeneralJpeg images, YCbCr encoding, and .Net Pin
object882-Feb-05 12:09
object882-Feb-05 12:09 
GeneralRe: Jpeg images, YCbCr encoding, and .Net Pin
Christian Graus2-Feb-05 12:11
protectorChristian Graus2-Feb-05 12:11 
GeneralRe: Jpeg images, YCbCr encoding, and .Net Pin
object882-Feb-05 12:32
object882-Feb-05 12:32 
GeneralRe: Jpeg images, YCbCr encoding, and .Net Pin
Christian Graus2-Feb-05 12:36
protectorChristian Graus2-Feb-05 12:36 
GeneralRe: Jpeg images, YCbCr encoding, and .Net Pin
object883-Feb-05 10:00
object883-Feb-05 10:00 
GeneralAdding Class file Pin
dasmeher2-Feb-05 11:32
sussdasmeher2-Feb-05 11:32 
GeneralRe: Adding Class file Pin
Christian Graus2-Feb-05 11:48
protectorChristian Graus2-Feb-05 11:48 
GeneralRe: Adding Class file Pin
MyThread2-Feb-05 11:55
MyThread2-Feb-05 11:55 
GeneralRe: Adding Class file Pin
Christian Graus2-Feb-05 11:58
protectorChristian Graus2-Feb-05 11:58 
GeneralRe: Adding Class file Pin
MyThread2-Feb-05 12:07
MyThread2-Feb-05 12:07 
GeneralRe: Adding Class file Pin
Christian Graus2-Feb-05 12:10
protectorChristian Graus2-Feb-05 12:10 
GeneralRe: Adding Class file Pin
MyThread2-Feb-05 12:21
MyThread2-Feb-05 12:21 
GeneralRe: Adding Class file Pin
Christian Graus2-Feb-05 12:24
protectorChristian Graus2-Feb-05 12:24 
GeneralRe: Adding Class file Pin
MyThread2-Feb-05 12:29
MyThread2-Feb-05 12:29 
GeneralRe: Adding Class file Pin
Christian Graus2-Feb-05 12:32
protectorChristian Graus2-Feb-05 12:32 
GeneralRe: Adding UserControl Pin
MyThread2-Feb-05 12:55
MyThread2-Feb-05 12:55 
GeneralRe: Adding UserControl Pin
Christian Graus2-Feb-05 12:59
protectorChristian Graus2-Feb-05 12:59 

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.