String example string comparison public static int

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: vanced formatting ToLower(), ToUpper() Format() much like C's printf but safe System Namespace System.String Example // string comparison Public static int Main() { string s =“abc”; string s1; s1 = s; // s1 and s refer to the same object string s2 = “abc”; if (s1 == s2) Console.WriteLine(“Strings are equal”); else Console.WriteLine(“This shouldn’t happen!”); return 0 } 10 System Namespace System.Text.StringBuilder Efficient way to build up a string by concatenating, replacing, inserting and removing substrings Automatically increases buffer size Can control manually too System Namespace Other Core Types System.Byte, System.SByte – Single byte numeric System.Char – Single Unicode character System.Boolean – True or False logical value System.Guid 128-bit, universally unique identifier Built-in generator: System.Guid.NewGuid() Intrinsic conversions to and from strings, byte arrays The "Nothings" System.DBNull – database-equivalent NULL type System.Empty – like COM's VT_EMPTY System.Missing – used with optional args 11 System Namespace Date and Time Support Syst...
View Full Document

Ask a homework question - tutors are online