Description Buq
The System.Text.Encoding.GetEncoding method relies on the underlying platform to support most code pages. However, system support is supplied for the following cases The default encoding, that is, the encoding specified in the regional settings for the computer executing this method little-endian Unicode UTF-16LE big-endian Unicode UTF-16BE Windows operating system Windows-1252 UTF-7 UTF-8 ASCII and GB18030 Chinese Simplified . Specify one of the names listed in the following table to obtain...
Example Jyc
public class ArrayListGetEnumerator ArrayList a new ArrayList a.Add damien a.Add mark a.Add brad IEnumerator e a.GetEnumerator 1,2 . while e.MoveNext Console.Write 0 , e.Current Console.WriteLine ArrayList.GetRange System.Int32, System.Int32 Method .method public hidebysig virtual class System.Collections.ArrayList GetRange int32 public virtual ArrayList GetRange int index, int count
Example Itv
Console.WriteLine Is 0 equal to l 2 , min, max, min.Equals max Console.WriteLine Is 0 equal to l 2 , min, min, min.Equals min Is 3.402823E 38 equal to 3.402823E 38 True E Is 3.402823E 38 equal to -3.402823E 38 False Is -3.402823E 38 equal to 3.402823E 38 False Is -3.402823E 38 equal to -3.402823E 38 True G .method public hidebysig virtual int32 GetHashCode K public override int GetHashCode L A System.Int32 containing the hash code for this instance. q The algorithm used to generate the hash...
Librarieskse Summary
Secures access to files and directories. CF public sealed class FilelOPermission CodeAccessPermission, IUnrestrictedPermission CF public FileIOPermission PermissionState state F public FileIOPermission FileIOPermissionAccess access, string path MS CF public FileIOPermission FileIOPermissionAccess access, string pathList Methods MS CF public void AddPathList FileIOPermissionAccess access, string path public void AddPathList FileIOPermissionAccess access, string pathList public override...
Example Mps
For brevity, the program only checks for the existence of one custom attibute, but for completeness, attributes are applied to most targets in the source code. The value Attribute-Targets.All could also have been used in the following program instead of using individual values. assembly Samples.MyCustom module Samples.MyCustom AttributeTargets.Class AttributeTargets.Constructor AttributeTargets.Delegate AttributeTargets.Enum AttributeTargets.Event AttributeTargets.Field...
Description Nco
This version of System.Type.GetEvent is equivalent to System.Type.GetEvent name, System.Reflection.BindingFlags.Static I I System.Reflection.BindingFlags.Public . B The search for name is case-sensitive. This member must be implemented if the Reflec tion Library is present in the implementation. is null.
Example Qlz
string s Hello world Console.WriteLine s s s.PadRight 2 0, '-' Console.WriteLine s s s.Trim '-' Console.WriteLine s Hello world Hello world -Hello world String.Remove System.Int32, System.Int32 Method .method public hidebysig instance string Remove int32 startIndex, int32 count C public string Remove int startIndex, int count
Example Bpg
public class NumberFormatlnfoCurrencyNegativePattern Culturelnfo c new CultureInfo en-NZ NumberFormatlnfo n c.NumberFormat 0 , n.CurrencyNegativePattern 0 ,, i 0 formatted with l yields 2 , d, s, d.ToString s, n Property .property int32 CurrencyPositivePattern public hidebysig specialname instance int32 get_CurrencyPositivePattern public hidebysig specialname instance void set_CurrencyPositivePattern int32 value C public int CurrencyPositivePattern get set
Example Pjx
StackOverflowException Constructor Console.WriteLine Exception , e Exception System.StackOverflowException Exception of type System.StackOverflowException was thrown. StackOverflowException Constructor public rtspecialname specialname instance void .ctor C
Example Qvj
public class MemoryStreamWriteByte byte bytes 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 using MemoryStream ms new MemoryStream bytes, bytes new byte 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 foreach byte b in bytes ms.Writebyte b ms.Seek 0, SeekOrigin.Begin for int i 0 i lt ms.Length i Console.WriteLine ms.ReadByte Method .method public hidebysig virtual void WriteTo class System.IO.Stream stream C public virtual void WriteTo Stream stream
Parameters Wxr
A WaitHandle array containing the objects for which the current instance will wait. This array cannot contain multiple references to the same object duplicates . The number of milliseconds to wait for the thread to receive a signal. true to exit the synchronization domain for the context before the wait if in a synchronized context , and reacquire it otherwise, false.
- 3.402823e 38 Equals
private static string CompareSingles Single dl, Single d2 int i d1.CompareTo d2 if 0 i return String.Format 0 is equal to l , dl, d2 if i gt 0 return String.Format 0 is greater than l , dl, d2 . else return String.Format 0 is less than l , dl, d2 Single max Single.MaxValue, min Single.MinValue Console.WriteLine CompareSingles min, min Console.WriteLine CompareSingles max, min Console.WriteLine CompareSingles min, max -3.402823E 38 is equal to -3.402823E 38 3.4 02 82 3E 3 8 is greater than...
Example Pvp
string strings system.object, system.string, notexist Type t Type.GetType s, true, true Console.WriteLine t Console.WriteLine Exception 0 , e Exception System.TypeLoadException Could not load type notexist from assembly G Type, Version 0.0.0.0, Culture neutral, PublicKeyToken null. at System.Type.GetType String typeName, Boolean throwOnError, Boolean ignoreCase at Samples.TypeGetType.Main in C Books BCL Samples System Type 18 Method M .method public hidebysig static class System.Type...
Example Jhx
using System using System.IO using System.Text string s filestream.txt using FileStream fs new FileStream s, FileMode.OpenOrCreate, FileAccess.Write Console.WriteLine FileStream opened on 0 , fs.Name string ds String.Format Written at 0 n, DateTime.Now.ToString K UTF8Encoding e new UTF8Encoding int count e.GetByteCount ds.ToCharArray , 0, ds.Length , Byte bytes new Byte count e.GetBytes ds, 0, ds.Length, bytes, 0 fs.Seek 0, SeekOrigin.End N fs.Write bytes, 0, bytes.Length O using FileStream fs...
Example Uwj
public class ArrayListBinarySearch Console.Write Values foreach object o in a Console.Write 0 , o Console.WriteLine SearchFor a, maire SearchFor a, leah SearchFor a, zoe public static void SearchFor ArrayList a, string s Object 0 , was found at l , s, i Console.WriteLine Object 0 , was not found, s No object in the array had a greater value. Console.WriteLine Object 0 , was not found, s Console.WriteLine The next larger object is at index 0 ., i Object maire, was found at 2 Object leah, was not...
Example Qju
int ints 0, 2, 4, 6, 8 Console.WriteLine The indices and elements of the array are for int i 0 i lt ints.Length i Console.Write 0 1, -5 , i, ints i Console.WriteLine SearchFor ints, 3 . SearchFor ints, 6 SearchFor ints, 9 public static void SearchFor Array a, Object o int i Array.BinarySearch a, 0, a.Length, o Console.WriteLine if i gt 0 Object 0 , was found at l , o, i Console.WriteLine Object 0 , was not found, o Console.WriteLine No object in the array had a greater value. Console.WriteLine...
Example Mqi
int indexArray 4, 2, 3 int lowboundArray 3, 2, 1 Array a Array.CreateInstance typeof int , indexArray, lowboundArray . for int i a.GetLowerBound O for int j a.GetLowerBound l j lt a.GetUpperBound l j a.SetValue 100 i 10 j k , i, j, k Console.WriteLine Value at 3, 2, 2 is 0 , a.GetValue 3, 2, 2 Array.SetValue System.Object, System.Int32 Method .method public hidebysig instance void SetValue object value, class System.Int32 public void SetValue object value, params int indices
V Summary Pqp
Implemented to support the System.IConvertible interface. Note For more information, see System.IConvertible.ToDouble. .method private final hidebysig virtual int32 System.IConvertible.ToInt32 class int IConvertible.ToInt32 IFormatProvider provider Method .method private final hidebysig virtual int16 System.IConvertible.ToInt16 class System.IFormatProvider provider short IConvertible.ToInt16 IFormatProvider provider Implemented to support the System.IConvertible interface. Note For more...
v Summary Dxt
Implemented to support the System.IConvertible interface. Note For more information, see System.IConvertible.ToDateTime. Method .method private final hidebysig virtual decimal System.IConvertible.ToDecimal class System.IFormatProvider provider decimal IConvertible.ToDecimal IFormatProvider provider Implemented to support the System.IConvertible interface. Note For more informa- E tion, see System.IConvertible.ToDecimal. Method H .method private final hidebysig Virtual float64...
Example Kfd
string strings one, two, three Console.Write Array elements foreach string s in strings Console.Write 0 , s Console.WriteLine Array.Reverse strings Console.Write Array elements foreach string s in strings Console.Write 0 , s Array elements one two three Array elements three two one Array.Reverse System.Array, System.Int32, System.Int32 Method .method public hidebysig static void Reverse class System.Array array, int32 public static void Reverse Array array, int index, int length
Example Eoj
ArrayList a new ArrayList a.Add damien a.Add mark ArrayList b ArrayList.FixedSize a PrintElements b a.Add maire J PrintElements b Console.WriteLine FixedSize ArrayList 0 , e public static void PrintElements IEnumerable ie P Console.Write Values foreach object o in ie Console.Write 0 , o R FixedSize ArrayList System.NotSupportedException Collection was of a fixed size, at obj at Samples.ArrayListFixedSize.Main in 2 0 Z Method .method public hidebysig static class System.Collections.IList...
Type Summary Ksx
protected Encoding MS protected Encoding int codePage public static Encoding ASCII get public static Encoding BigEndianUnicode get public virtual string BodyName get public virtual int CodePage get public static Encoding Default get public virtual string EncodingName get public virtual string HeaderName get public virtual bool IsBrowserDisplay get public virtual bool IsBrowserSave get public virtual bool IsMailNewsDisplay get public virtual bool IsMailNewsSave get public static Encoding Unicode...
Example Bqy
For the object type Console.WriteLine FullName 0 , t.FullName 0 , t.IsAutoLayout 0 , t.IsExplicitLayout 0 , t.IsLayoutSequential For the object type FullName System.Object IsAutoLayout True B IsExplicitLayout False .property bool IsMarshalByRef public hidebysig specialname instance bool G get_IsMarshalByRef
Example Adk
Double doubles -1, -0.5, 0, 0.5, 1 foreach Double d in doubles Console.WriteLine Cosh 0 l , d, Math.Cosh d Cosh -l 1.54308063481524 Cosh -0.5 1.12762596520638 Cosh 0 1 Cosh 0.5 1.12762596520638 Cosh 1 1.54308063481524 Math.DivRem System.Int32, System.Int32, System.Int32 Method .method public hidebysig static int32 DivRem int32 a,int32 b, out int32 amp result C public static int DivRem int a, int b, out int result
Example Yei
IFormatProvider f new CultureInfo en-AU, true string s String.Format t 0 , DateTime.Now.ToString f DateTime d DateTime.Parse s, f, DateTimeStyles.AllowWhiteSpaces Console.WriteLine String 0 yields date l , s, d d DateTime.Parse s, f, DateTimeStyles.AllowLeadingWhite DateTimeStyles.AllowInnerWhite DateTimeStyles.AllowTrailingWhite Console.WriteLine String 0 yields date l , s, d s String.Format 0 t, DateTime.Now.ToString T, f d DateTime.Parse s, f, Console.WriteLine String 0 yields date l , s, d...
Return Value Frf
An array of System.Type objects representing all types nested within the type repre- Q sented by the current instance that match the specified binding constraints, if any. Other- r wise, returns an empty System.Type array. If the type reflected by the current instance is contained in a loaded assembly, the type that matches the specified criteria is not public, and the caller does not have sufficient permission, returns only public types. The following System.Reflection.BindingFlags are used to...
Example Wfq
B public class CharIsLetterOrDigit Char chars new Char E '3', '-', 'z', ' ', Convert.ToChar 0X0 0BC Console.WriteLine Char ' 0 ' is letter H or digit, c Console.WriteLine Char ' 0 ' is not letter O Char '3' is letter or digit Char '-' is not letter or digit Char 'z' is letter or digit Char ' ' is not letter or digit Char 'A' is not letter or digit Char.IsLetterOrDigit System.String, System.Int32 Method .method public hidebysig static bool IsLetterOrDigit string s, int32 index W public static...
Example Njx
DuplicateWaitObjectException Constructor public class DuplicateWaitObjectExceptionSample public static AutoResetEvent autoResetEvents autoResetEvents 0 new AutoResetEvent false HI autoResetEvents 1 autoResetEvents 0 catch DuplicateWaitObjectException e F Console.WriteLine Exception 0 , e Exception System.DuplicateWaitObjectException Duplicate objects in argument. millisecondsTimeout, Boolean exitContext, Boolean WaitAll at waitHandles, Int32 millisecondsTimeout, Boolean exitContext at...
Example Tlm
Culturelnfo c new CultureInfo en-AU NumberFormatInfo n c.NumberFormat Console.WriteLine From Double 0 yields d, Convert.ToString d, c d Double.MinValue Console.WriteLine From Double 0 yields d, Convert.ToString d, c d Double.Epsilon Console.WriteLine From Double 0 yields d, Convert.ToString d, c d Double.Positivelnfinity Console.WriteLine From Double 0 yields d, Convert.ToString d, c d Double.Negativelnfinity Console.WriteLine From Double 0 yields d, Convert.ToString d, c Console.WriteLine From...
Description Aji
This constructor initializes the System.StackOverflowException.Message property of the new instance to a system-supplied message that describes the error, such as Q The requested operation caused a stack overflow. This message takes into account the R current system culture. The property is initial H ized to null. T Constructor V public rtspecialname specialname instance void .ctor string message X public StackOverflowException string message StackOverflowException Constructor
Example Hat
short max short.MaxValue, min short.MinValue Console.WriteLine Abs 0 l , max, Math.Abs max Console.WriteLine Abs 0 l , min l, Math.Abs min l Console.WriteLine Abs 0 l , min, Math.Abs min Console.WriteLine Exception 0 , e Abs 32767 32767 Abs -32767 32767 Exception System.OverflowException Negating the minimum value of a twos complement number is invalid. at System.Math.AbsHelper Int16 value at System.Math.Abs Int16 value at Samples.MathAbs.Main in C Books BCL Samples System Math Abs System.Int16...
Example Bub
ushort max ushort.MaxValue, min ushort.MinValue Console.WriteLine 0 is l , max, Decimal max Console.WriteLine 0 is l , System.Decimal Method .method public hidebysig static specialname bool op_GreaterThan decimal dl, public static bool operator gt decimal dl, decimal d2
Exceptions Xyg
element is not a constructor, method, property, event, type, or field.
Example Cmv
public class StreamWriterSample Q string s streamwriter.txt using StreamWriter sw new StreamWriter s T MemoryStream ms new MemoryStream W using StreamWriter sw new StreamWriter ms X Byte bytes foreach Byte b in bytes Console.Write char b public static void DisplayInformationAboutStream StreamWriter sw Console.WriteLine Encoding 0 , sw.Encoding C Console.WriteLine Can read from stream 0 , sw.BaseStream.CanRead Console.WriteLine Can write to stream 0 , sw.BaseStream.CanWrite Console.WriteLine Can...
Example Qwl
using System using System.Text A using System.Globalization public class StringBuilderAppendFormat StringBuilder sb new StringBuilder Object objects DateTime.Now, G -42, Hello world string f Date 0 dd MM yy Integer 1,10 String 2 J sb.AppendFormat f, objects Console.WriteLine Length 0 , sb.Length Date 23 0S 03 Integer -42 String Hello world System.String, System.Object Method .method public hidebysig instance class System.Text.StringBuilder V AppendFormat class System.IFormatProvider provider,...
Example Fmz
The following example uses a component, ClassToCall, defined in one file and a client M class, SecurityActionInheritanceDemand, defined in another file. assembly SecurityAction.LinkDemand, V PublicKey W 0 0240000 04 800000 94 00000006 02 0000 0 024000052 53413100 04 000001000100 X 0 97DAF2 73 6C757612 08E3DECBAE3 9F1F 4F819CE6 77E5C91E3B16 7CA0 93 9 0244 9 2 0B4A1C076 83 08172 5BE9 04 31DC4AF4A 7FC3FDB42 8A05818 96 3 88BC83 7 0F3D34 DE1FF10B95ED76 52B1DA0E4DB2 5 07 077 07E7 0...
Exceptions Awk
waitHandles is null or one or more elements in the waitHandles array is null. waitHandles contains elements that are duplicates. The number of objects in waitHandles is greater than the system permits.
Example Jci
IDictionary id new Hashtable id.Add 1, damien id.Add 2, mark id.Add 3, brad IEnumerator e ic.GetEnumerator while e.MoveNext Console.WriteLine Key 0 , e.Current L .property class System.Collections.ICollection Values public hidebysig virtual U abstract specialname class System.Collections.ICollection get_Values C
Example Hyj
Random r new Random E DisplayNumbers r, 4 r new Random DisplayNumbers r, 4 r new Random unchecked int DateTime.Now.Ticks H DisplayNumbers r, 4 Byte bytes new Byte 4 1 r.NextBytes bytes foreach Byte b in bytes K Console.Write 0 , b public static void DisplayNumbers Random r, int number for int i 0 i lt number i O Console.Write 0 , r.Next Console.WriteLine Console.WriteLine Doubles q for int i 0 i lt number i Console.Write 0 , r.NextDouble Console.WriteLine W 610101060 182710372 541839654...
Example Cze
Console.WriteLine From String 0 yields 1 , s, Convert.ToInt16 s Console.WriteLine From String 0 yields 1 , s, Convert.ToInt16 s s Int16.MinValue.ToString Console.WriteLine From String 0 yields 1 , s, Convert.ToInt16 s Console.WriteLine From String 0 yields 1 , s, Convert.ToInt16 s Console.WriteLine Exception 0 , e s Int16.MaxValue 1 .ToString F Console.WriteLine From String 0 yields 1 , s, Convert.ToInt16 s Console.WriteLine Exception 0 , e 1 Exception System.FormatException Input string was...
Example Yzk
public class NumberFormatlnfoCurrencyGroupSizes Culturelnfo c new NumberFormatInfo n c.NumberFormat Console.Write CurrencyGroupSizes foreach int i in n.CurrencyGroupSizes Console.Write 0 , i Console.WriteLine H n.CurrencyGroupSizes new int 2, 3 1 foreach int i in n.CurrencyGroupSizes . Console.Write 0 , i J 0 formatted with l yields 2 , Property 42000000 formatted with C yields 42 0,000,00.00 .property int32 CurrencyNegativePattern public hidebysig specialname instance W int32...
Example Xft
public string name public static void Main string strings System.Object, System.String, NotExists foreach string s in strings Console.WriteLine Exception 0 , e Type.GetType System.String, System.Boolean Method U .method public hidebysig static class System.Type GetType string typeName, bool throwOnError C public static Type GetType string typeName, bool throwOnError
Bfs Standard Library
using System using System.Security A using System.Security.Permissions public class EnvironmentPermissionConstructor E string ev COMPUTERNAME new EnvironmentPermission ev . p.Assert I TestAccess ev CodeAccessPermission.RevertAssert J p.Deny CodeAccessPermission.RevertDeny L p.PermitOnly TestAccess ev O public static void TestAccess string s Console.WriteLine R Environment Variable 0 Value l , Environment Variable 0 cannnot be read, Environment Variable COMPUTERNAME Value PROJECT42 Environment...
Example Tlr
Console.WriteLine From Single 0 yields 1 , f, Convert.ToUInt16 f Console.WriteLine From Single 0 yields 1 , f, Convert.ToUInt16 f f Single.MaxValue Console.WriteLine From Single 0 yields 1 , f, Convert.ToUInt16 f Console.WriteLine Exception 0 , e From Single 0 yields 0 From Single 25.5 yields 26 Exception System.OverflowException Value was either too large or too small for an Int32. at System.Convert.ToInt32 Double value at System.Convert.ToUInt16 Single value at Samples.ConvertToUInt16.Main in...
Description Jzb
The following table describes the valid values for this property. is used as the value for - is used as the value for and 999 represents any numeric value. The culture-invariant value for this property is 0. The value specified for a set operation is less than 0 or greater than 2. The current instance is read-only and a set operation was attempted.
Parameters Ncn
true to throw any exception that occurs. false to ignore any exception that occurs. The type associated with the specified program identifier ProgID , if progID is a valid entry in the registry and a type is associated with it otherwise, null . This method is provided for COM support. Program IDs are not used in Microsoft .NET Framework because they have been superseded by the concept of namespace. The specified ProgID is not registered. To enhance security and performance when invoked...
Example Ilx
Console.WriteLine From Double 0 yields d, Convert.ToInt64 d Console.WriteLine From Double 0 yields d, Convert.ToInt64 d Console.WriteLine From Double 0 yields d, Convert.ToInt64 d Console.WriteLine From Double 0 yields d, Convert.ToInt64 d d Double.MaxValue Console.WriteLine From Double 0 yields d, Convert.ToInt64 d Console.WriteLine Exception 0 , e From Double 4.94065645841247E-324 yields 0 From Double 0 yields 0 From Double 5.5 yields 6 From Double -5.5 yields -6 Exception...
Description Ilx
The System.IO.FileStream.Read method returns zero only after reaching the end of the stream. Otherwise, System.IO.FileStream.Read always reads at least one byte from the stream before returning. If no data is available from the stream, this method blocks until at least one byte of data can be returned. If the read operation is successful, the current position of the stream is advanced by the number of bytes read. If an exception occurs, the current position of the stream is unchanged. Note Use...
P Example
public class DateTimeStylesAllowInnerWhite IFormatProvider f new CultureInfo en-AU, true , string s DateTime.Now.ToString W dd MM yyyy t hh mm, f DateTimeStyles.AllowInnerWhite Y Console.WriteLine String 0 yields date l , Enum String 10 06 2003 01 33 yields date 10 06 2003 1 33 00 AM DateTimeStyles.AllowLeadingWhite Field .field public static literal valuetype Specifies that leading white space characters are allowed. 10 06 2003 01 36 yields date 10 06 2003 1 36 00 AM public class...
Parameters Evg
A System.String containing a number. The base of the number in value, which must be 2, 8, 10, or 16. If fromBase is 16, you can prefix the number specified by the value parameter with 0x or OX. System.ArgumentException fromBase is not 2, 8, 10, or 16. value is less than System.Byte.MinValue or greater System.Overfl wException than System.Byte.MaxValue. Convert.ToByte System.String, System.IFormatProvider Method .method public hidebysig static unsigned int8 ToByte string value, class public...
