1. Question: Which of the following is the correct code to close all references to the com objects below?
    Workbooks books = excel.WorkBooks;
    Workbook book = books[1];
    Sheets sheets = book.WorkSheets;
    Worksheet ws = sheets[1];

    A
    Marshal.ReleaseComObject(books);

    B
    Marshal.FinalReleaseComObject(books);

    C
    Marshal.ReleaseComObject(sheets); Marshal.ReleaseComObject(books);

    D
    Marshal.ReleaseComObject(sheet); Marshal.ReleaseComObject(sheets); Marshal.ReleaseComObject(book); Marshal.ReleaseComObject(books);

    Note: Not available
    1. Report
  2. Question: Which of the following is the correct way to sort a C# dictionary by value?

    A
    List<KeyValuePair<string, string>> myList = aDictionary.ToList(); myList.Sort( delegate(KeyValuePair<string, string> firstPair, KeyValuePair<string, string> nextPair) { return firstPair.Value.CompareTo(nextPair.Value); } );

    B
    List<KeyValuePair<string, string>> myList = aDictionary.ToList(); myList.Sort((firstPair,nextPair) => { return firstPair.Value.CompareTo(nextPair.Value); } );

    C
    foreach (KeyValuePair<string,int> item in keywordCounts.OrderBy(key=> key.Value)) { // do something with item.Key and item.Value }

    D
    var ordered = dict.OrderBy(x => x.Value);

    Note: Not available
    1. Report
Copyright © 2024. Powered by Intellect Software Ltd