Please check the under path:
http://zh.wikipedia.org/zh-tw/%E6%97%8B%E8%BD%AC
http://yuqingping.blog.51cto.com/902397/935219
2014年2月18日 星期二
2014年2月17日 星期一
ASCII <-> Unicode(CLI)
A sample code from msdn(Unicode to ASCII)
String^ unicodeString = "This string contains the unicode character Pi (\u03a0)";
// Create two different encodings.
Encoding^ ascii = Encoding::ASCII;
Encoding^ unicode = Encoding::Unicode;
// Convert the string into a byte array.
array<Byte>^unicodeBytes = unicode->GetBytes( unicodeString );
// Perform the conversion from one encoding to the other.
array<Byte>^asciiBytes = Encoding::Convert( unicode, ascii, unicodeBytes );
// Convert the new Byte into[] a char and[] then into a string.
array<Char>^asciiChars = gcnew array<Char>(ascii->GetCharCount( asciiBytes, 0, asciiBytes->Length ));
ascii->GetChars( asciiBytes, 0, asciiBytes->Length, asciiChars, 0 );
String^ asciiString = gcnew String( asciiChars );
// Display the strings created before and after the conversion.
Console::WriteLine( "Original String*: {0}", unicodeString );
Console::WriteLine( "Ascii converted String*: {0}", asciiString );
Please check the page:
http://msdn.microsoft.com/zh-tw/library/kdcak6ye%28v=vs.110%29.aspx
http://studio.wellwind.idv.tw/archives/197
String^ unicodeString = "This string contains the unicode character Pi (\u03a0)";
// Create two different encodings.
Encoding^ ascii = Encoding::ASCII;
Encoding^ unicode = Encoding::Unicode;
// Convert the string into a byte array.
array<Byte>^unicodeBytes = unicode->GetBytes( unicodeString );
// Perform the conversion from one encoding to the other.
array<Byte>^asciiBytes = Encoding::Convert( unicode, ascii, unicodeBytes );
// Convert the new Byte into[] a char and[] then into a string.
array<Char>^asciiChars = gcnew array<Char>(ascii->GetCharCount( asciiBytes, 0, asciiBytes->Length ));
ascii->GetChars( asciiBytes, 0, asciiBytes->Length, asciiChars, 0 );
String^ asciiString = gcnew String( asciiChars );
// Display the strings created before and after the conversion.
Console::WriteLine( "Original String*: {0}", unicodeString );
Console::WriteLine( "Ascii converted String*: {0}", asciiString );
Please check the page:
http://msdn.microsoft.com/zh-tw/library/kdcak6ye%28v=vs.110%29.aspx
http://studio.wellwind.idv.tw/archives/197
2014年2月10日 星期一
C# (keyword: set, get, value)
set: A set accessor is used to assign a new value.(只是增加一些變數(pulbic)的方便性,asign時, 會跑進來)
get: A get property accessor is used to return the property value.(只是增加一些變數(pulbic)的方便性, 取值時, 會跑進來)
value: The value keyword is used to define the value being assigned by the set accessor.(即assign進來的值)
請看下面範例(來源:微軟官網, 如有侵權, 請來告知, 馬上刪除):
class TimePeriod
{ private double seconds; public double Hours { get { return seconds / 3600; } set { seconds = value * 3600; } } } class Program { static void Main() { TimePeriod t = new TimePeriod(); // Assigning the Hours property causes the 'set' accessor to be called. t.Hours = 24; // Evaluating the Hours property causes the 'get' accessor to be called. System.Console.WriteLine("Time in hours: " + t.Hours); } }
// Output: Time in hours: 24
------------------------------------------------------------
This is an example of a get accessor in an auto-implemented property
class TimePeriod2 { public double Hours { get; set; } }
訂閱:
文章 (Atom)