Loading...

Finding the indices of the elements of one array in another using LINQ

View: 181    Dowload: 0   Comment: 0   Post by: admin   Category: Visual studio & .NET   Fields: Other

Given two arrays A and B, find the index from A of the element of B

Dim A As String() = {"a", "b", "c", "d", "e", "f", "g", "h", "i"}
Dim B As String() = {"b", "d", "e"}

For Each item As String In B
    Dim index1 As Integer = Array.IndexOf(A, item)
    Console.WriteLine("{0} {1}", index1, item)
Next

1 b
3 d
4 e

Here is one way...

Dim A As String() = {"a", "b", "c", "d", "e", "f", "g", "h", "i"}
Dim B As String() = {"b", "d", "e"}

Dim c = A.Select(Function(x, i) New KeyValuePair(Of String, Integer)(x, i)) _
         .Where(Function(x) B.Contains(x.Key))

For Each item In c
    Console.WriteLine("{0} - {1}", item.Key, item.Value)
Next

 

Finding the indices of the elements of one array in another using LINQ

Given two arrays A and B, find the index from A of the element of B

Posted on 08-02-2018 

Comment:

To comment you must be logged in members.

Files with category

  • Pharmacy/Chemist POS and Invoicing Software

    Pharmacy/Chemist POS and Invoicing Software

    View: 144    Download: 14   Comment: 0

    Category: Visual studio & .NET     Fields: none

    Pharmacy POS /Chemist Management System allows User to sell medicine , Over the counter or at any Hospital, Easily Integrated with Email to SEND invoices and Print Receipt. This is one of my very best Project i Decided to Share with you Guys ...

  • Computer-Based Inventory Management System in VB.net

    Computer-Based Inventory Management System in VB.net

    View: 117    Download: 9   Comment: 0

    Category: Visual studio & .NET     Fields: none

    This is a project entitled Computer-Based Inventory Management System written in Vb.net and Microsoft access database for Surigao Doctors College. The system has the following features: - Cataloging - Inventory - Circulation - Borrow - Return - View...

  • Salary Management System

    Salary Management System

    View: 154    Download: 12   Comment: 0

    Category: Visual studio & .NET     Fields: none

    Introduction: ----------------- *This project is based on accounts concept. *Salary Management System is a DataBase system which can be used for managing employee Salary Details. *It is a multi-user system and can be used by hundreds of user at the...

  • New Print-maker Cyber Cafe

    New Print-maker Cyber Cafe

    View: 98    Download: 1   Comment: 0

    Category: Visual studio & .NET     Fields: none

    New Printmaker Cyber Cafe ------------------------- Before you run this project, please set the following date format “dd/MM/yyyy” to your computer. Introduction: -------------- The purpose of developing this software project is to fully automate...

  • Folder Locker 7.0

    Folder Locker 7.0

    View: 178    Download: 3   Comment: 0

    Category: Visual studio & .NET     Fields: none

    Folder Lock is great security app that lets you password-protect files, folders and drives; encrypt your important files on-the-fly, backup files in real-time, protect portable drives, shred files & drives and clean history. Folder Lock can...

  • Bakeshop Inventory System in VB.Net and MS Access Database

    Bakeshop Inventory System in VB.Net and MS Access Database

    View: 191    Download: 9   Comment: 0

    Category: Visual studio & .NET     Fields: none

    Bakeshop Inventory System is a software based system especially designed for a Bakeshop business and for the inventory process. This system will be able to track the daily, weekly, monthly and yearly inventory of products. In this way, the staff can...

  • Bezier Curve Machine Learning Demonstration

    Bezier Curve Machine Learning Demonstration

    View: 83    Download: 0   Comment: 0

    Category: Visual studio & .NET     Fields: Other

    I enjoy working with longitudinal data. This is the second article in a series about using Bezier curves to smooth large data point fluctuations and improve the visibility of the patterns unfolding. This current article focuses on using machine...

  • Basic Library Management System

    Basic Library Management System

    View: 148    Download: 4   Comment: 0

    Category: Visual studio & .NET     Fields: none

    Library System is designed to store students (borrowers) info and their individual file in an institution regarding on the library transactions. This system is a user-friendly program able to print reports, view students’ file or transactions in the...

 
File suggestion for you
Loading...
File top downloads
Loading...
Loading...
Codetitle - library source code to share, download the file to the community
Copyright © 2018. All rights reserved. codetitle Develope by Vinagon .Ltd