locked
Contains from C# to VB - problem RRS feed

  • Question

  • User1653500150 posted

    I have a code in C#:

     list.RemoveAll(exclude.Contains);


    After convert to VB (using converters found with google) I have this:

    list.RemoveAll(exclude.Contains)


    and error:  Overload resolution failed because no accessible 'Contains' accepts this number of arguments.


    Can anyone help me?

    This this the whole function in C# which I need in VB:

     public static List<string> StringToList(this string str, char delimiter, List<string> exclude)
        {
          if (String.IsNullOrEmpty(str))
          {
            throw new ArgumentException("str is null or empty.", "str");
          }
    
          if (exclude == null)
          {
            throw new ArgumentNullException("exclude", "exclude is null.");
          }
    
          var list = str.Split(delimiter).ToList();
    
          list.RemoveAll(exclude.Contains);
          list.Remove(delimiter.ToString());
    
          return list;
        }







    Saturday, March 20, 2010 3:25 PM

Answers

  • User397347636 posted
    list.RemoveAll(AddressOf exclude.Contains)


     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, March 21, 2010 7:52 PM

All replies

  • User-1360095595 posted

    Does the C# code actually work?  I don't know how exclude.Contains would work, since Contains is a method.

    Saturday, March 20, 2010 4:09 PM
  • User397347636 posted
    list.RemoveAll(AddressOf exclude.Contains)


     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, March 21, 2010 7:52 PM
  • User1653500150 posted
    // Get styles table for user 
          // this should be called once for groups and for rank for each user/post.
          DataTable roleRankStyleTable = YafContext.Current.Cache.GetItem(
            YafCache.GetBoardCacheKey(Constants.Cache.GroupRankStyles),
            YafContext.Current.BoardSettings.ForumStatisticsCacheTimeout,
            () => DB.group_rank_style(YafContext.Current.PageBoardID));


    Can anyone help me with the code above?

    How it will be in VB?


    Wednesday, May 19, 2010 7:45 AM