ISO/IEC TECHNICAL REPORT TR 25438 First edition 2006-08-01 Information technology Common Language Infrastructure (CLl) - Technical Report: Common Generics Technologies de I'information Infrastructure commune de langage (ICL)-Rapport technique: Génériques communs Reference number ISO/IEC TR 25438:2006(E) IEC ISO @ISO/IEC2006 ISO/IEC TR 25438:2006(E) PDFdisclaimer This PDF file may contain embedded typefaces. In accordance with Adobe's licensing policy, this file may be printed or viewed but shall not be edited unless the typefaces which are embedded are licensed to and installed on the computer performing the editing. In downloading this file, parties accept therein the responsibility of not infringing Adobe's licensing policy. The Iso Central Secretariat accepts no liability in this area. Adobe is a trademark of Adobe Systems Incorporated. Details of the software products used to create this PDF file can be found in the General Info relative to the file; the PDF-creation ? ISO/IEC2006 All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized in any form or by any means, electronic or mechanical, including photocopying and microfilm, without permission in writing from either isO at the address below or IsO's member body in the country of the requester. ISO copyright office Case postale 56 . CH-1211 Geneva 20 Tel. + 41 22 749 01 11 Fax + 41 22 749 09 47 E-mail
[email protected] Web www.iso.org Published in Switzerland @ ISO/IEC 2006 -All rights reserved ISO/IECTR25438:2006(E) Contents Page Foreword. Introduction VI 1 Scope 2 Rationale.. 2.1 Reference vs. value tuples.... 2.2 Interaction with other standard types.... 3 Overview.. 3.1 Tuple types. 3.2 Function and procedure types 3.3 Unit.. 3.4 Optional , 3.5 Either... 4 Action delegates ... 4.1 System.Action delegate 4.2 System.Action<A, B> delegate... 4.3 System.Action<A, B, C> delegate . 4.4 System.Action<A, B, C, D> delegate. 4.5 System.Action<A, B, C, D, E> delegate . 5 System.DelegateCast class .. 9 5.1 DelegateCast.ToFunction<T, Boolean>(System.Predicate<T>) method.. 10 5.2 DelegateCast.ToPredicate<T>(System.Function<T, System.Boolean>) method 10 5.3 DelegateCast..ToFunction<T, U>(System.Converter<T, U>) method.... 11 5.4 DelegateCast.ToConverter<T, U>(System.Function<T, U>) method.. 12 5.5 5.6 DelegateCast.ToComparison<T>(System.Function<T, T, System.Int32>) method 13 6 System..Either<A, B> Structure ..... 13 6.1 Either<A, B>.Equals(System.Object) method. 15 6.2 Either<A, B>.Equals(Either<A, B>) method... 16 6.3 Either<A, B>.First property... 17 6.4 Either<A, B>.GetHashCode() method. 17 6.5 Either<A, B>.IsFirst property. 18 6.6 Either<A, B>.lsSecond property... 19 6.7 Either<A,B>.opEquality(Either<A,B>,Either<A,B>)method. 19 6.8 Either<A, B>.op_Inequality(Either<A, B>, Either<A, B>) method .... 6.9 Either<A, B>.Second property.... 21 6.10 Either<A, B>.MakeFirst(A aValue) method. 22 6.11 Either<A, B>.MakeSecond(B bValue) method 22 6.12 Either<A, B>.ToString() method. 23 6.13 Either<A, B>(A) constructor, 23 6.14 Either<A, B>(B) constructor 24 6.15 A Either<A, B>.op_Explicit(System.Either<A, B>) method , 6.16 B Either<A, B>.op_Explicit(System.Either<A, B>) method . 26 6.17 Either<A, B>.op_implicit(A) method ... 27 6.18 Either<A, B>.op_Implicit(B) method ... 28 7 Function Delegates... 29 7.1 System.Function<A > delegate .. 29 7.2 System.Function<A, B> delegate. .30 7.3 System.Function<A, B, C> delegate , 31 n All rights reserved ii ISO/IEC TR 25438:2006(E) 7.4 System.Function<A, B, C, D> delegate.. 32 7.5 System.Function<A, B, C, D, E> delegate 7.6 System.Function<A, B, C, D, E, F> delegate .35 8 System.Optional<T> structure. 36 8.1 Optional<T>(T) constructor.... 8.2 Optional<T>.CompareTo(System.Object) method. ..38 8.3 Optional<T>.CompareTo(Optional<T>) method. 8.4 Optional<T>.Equals(System.Object) method.. ..41 8.5 Optional<T>.Equals(Optional<T>) method.. 8.6 Optional<T>.FromNullable<U>(Nullable<U>) method, 43 8.7 Optional<