.NET Questions # 2

    The first part of the questions can be found here.
    Continue:

    1) As you know, System.Array does not implement IEnumerable, ICollectionIList, where T is the type of array (by the way, why?). However, when using such arrays, you can use everything that these interfaces provide (if the array contains only elements of a reference type). How is that?

    2) You executed this code:
    Console.WriteLine(a.GetType()) ;
    and got the result.
    SomeNamespace.SomeType[*];
    What kind of type is this?

    3) What code will work faster and why?
    A or B 4) what is the difference in operation between the following two methods: and 5) In the documentation, the type of Int32 is defined as follows: however, the following code will fail with a compilation error (int doesn't contain a def. For 'ToSingle'): Why so ? 6)
    ...
    Int32[] a = new Int32[100];
    int len = a.Length;
    for(Int32 index = 0; index < len; index++) {
    //operations with a[index];
    }
    ...




    ...
    Int32[] a = new Int32[100];
    for(Int32 index = 0; index < a.Length; index++) {
    //operations with a[index];
    }
    ...



    private static Int32 M(T t) where T: IComparable{...}

    private static Int32 M(IComparable t) {...}


    [SerializableAttribute]
    [ComVisibleAttribute(true)]
    public struct Int32 : IComparable, IFormattable,
    IConvertible, IComparable, IEquatable




    Int32 x = 5;
    Single s = x.ToSingle();




    Is there a way when calling the delegate chain to get the return value of all methods, and not just the last?

    7) Which method cannot apply any attribute?

    That's all for today. Answers after discussion, if necessary :)

    ps If you are minus, then write for what at least ...

    Also popular now: