'Order by' is not a member of 'FlickrNet.PhotoCollection'

Apr 22, 2010 at 1:17 PM

I'm randomising 10 images using this for Photocollection Pictures

Pictures.OrderBy(Function(p) Guid.NewGuid()).Take(no_images)

I built this this morning and it works fine.  I've copied and pasted the code no changes and I'm getting the 'order by' line underlined with the comment in the title.  Any ideas?

Coordinator
Apr 22, 2010 at 1:38 PM

OK, firstly, it took me a while to even realise that this was VB.Net. It would have been helpful if you could have pointed that out.

Secondly it sounds like you haven't got a reference to System.Linq in your project.

OrderBy is an extension method defined by the SystemLinq namespace on all enumerable types (which PhotoCollection is), and is nothing to do with me.

Apr 22, 2010 at 1:55 PM

Firstly, will do in future.

Secondly, thanks. sorted.

 

Feb 11, 2012 at 12:23 AM

At risk of sounding like and idiot, if I am not using VS and but using VB.NET how do I add a reference to System.Linq?
I am writing this mainly with a text editor.

I've added it to my namespace in my web.config. I fear I am using a very old version of VB.NET

Microsoft (R) Visual Basic Compiler version 8.0.50727.3053
for Microsoft (R) .NET Framework version 2.0.50727.3623
Copyright (c) Microsoft Corporation.  All rights reserved.

I get a message from adding system.linq and a couple others:

vbc : warning BC40057: Namespace or type specified in the project-level Imports 'System.Xml.Linq'
doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined
and contains at least one public member. Make sure the imported element name doesn't use any aliases. vbc : warning BC40057: Namespace or type specified in the project-level Imports 'System.Linq' doesn't
contain any public member or cannot be found. Make sure the namespace or the type is defined and contains
at least one public member. Make sure the imported element name doesn't use any aliases. vbc : warning BC40057: Namespace or type specified in the project-level Imports 'System.Data.Linq' doesn't
contain any public member or cannot be found. Make sure the namespace or the type is defined and contains
at least one public member. Make sure the imported element name doesn't use any aliases.

Thanks Sam.

 

 

 

Coordinator
Feb 11, 2012 at 6:48 PM

System.Linq is in the System.Core.dll. You probably haven't told the compiler to include it. I don't know how to do this as visual studio does it for you when you add a reference to a project.

Not really a FlickrNet problem though is it - you'd be better off just posting over at the MSDN forums, or probably searching google.

Sam

Feb 11, 2012 at 11:54 PM

Thanks. It is not a FlickrNet issue. I did find the solution:

At a minimum, this has to be in your web.config:

 

<assemblies>
                                <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

                                <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
                              <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> 
                              <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> 
                              <add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>   
 </assemblies>

 and:

<system.codedom>       
<compilers>           
     <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">               
<providerOption name="CompilerVersion" value="v3.5"/>               
<providerOption name="WarnAsError" value="false"/>           
</compiler>           
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">               
<providerOption name="CompilerVersion" value="v3.5"/>               
<providerOption name="OptionInfer" value="true"/>               
<providerOption name="WarnAsError" value="false"/>           
</compiler>       
</compilers>   
</system.codedom>

This should do the trick. I found the solution at: http://forums.asp.net/t/1264863.aspx