I am creating a Portable Class Library (PCL) and I am trying to use List.Exists() and List.TrueForAll(), but I am being told that System.Collections.Generic.List does not contain a definition for either Exists or TrueForAll. The PCL I am creating is to work across the .Net 4.5, Silverlight 4, Windows Phone 7.5, Mono Android, and Mono iOS. Is there something that I am missing?
Note: This code works in a .Net 4.0 Library which I have made.
Code Examples which return errors:
List<object> set0;
List<object> set1;
if (set0.TrueForAll(obj0 => set1.Exists(obj1 => obj0.Equals(obj1))))
return true;
if(!(set0.Exists(obj0 => !set1.Exists(obj1 => obj0.Equals(obj1)))))
return true;
Errors Recived:
Error: 'System.Collections.Generic.List' does not contain a
definition for 'Exists' and no extension method 'Exists' accepting a
first argument of type 'System.Collections.Generic.List'
could be found (are you missing a using directive or an assembly
reference?)
Error: 'System.Collections.Generic.List' does not contain a
definition for 'TrueForAll' and no extension method 'TrueForAll'
accepting a first argument of type
'System.Collections.Generic.List' could be found (are you
missing a using directive or an assembly reference?)
You seem to be trying to determine, in a cumbersome way, if set0 is a subset (mathematically) of set1. If you change your type from List<> to HashSet<> or SortedSet<>, you will get this functionality for free.
Otherwise, consider to use
set0.Except(set1).Any()
from Linq.
I'm not sure which methods exist in the Portable Class Library (PCL), but according to the List<>.Exists doc this method does. And also the Linq methods I mentioned.
Related
The ProductManagement and ResourceManagement use the following command to do that
Container.RegisterWcf(WcfHostFactory);
But when I try to do that in my custom module, I get the following error message:
CS1061 'IContainer' does not contain a definition for 'RegisterWcf' and no accessible extension method 'RegisterWcf' accepting a first argument of type 'IContainer' could be found (are you missing a using directive or an assembly reference?)
Am I missing an assembly reference? And if that's the case: Which one am I missing?
In preparation for cross-platform we extracted WCF to an isolated package Moryx.Runtime.Wcf. That also contains the container extension.
I am currently unable to apply a CustomOverlay to my MobileBarcodeScanner instance and according the documentation on their website, I should be able to but it gives me the following error.
Severity Code Description Project File Line Suppression State
Error CS1061 'MobileBarcodeScanner' does not contain a definition for 'CustomOverlay' and no extension method 'CustomOverlay' accepting a first argument of type 'MobileBarcodeScanner' could be found (are you missing a using directive or an assembly reference?) ScannerTesting C:\Users\kalpr\Source\Repos\ScannerTesting\ScannerTesting\ScannerTesting\MainViewModel.cs 88 Active
I am doing this in my .Net Standard Class library which shares the code between all the different platforms.
Should I be doing this natively for each platform or can I just declare it in the portable .NET Standard project?
I am building an application which requires accessing Dropbox. Since there is no api for windows phone yet, i am using the ReactiveOAuth to achieve this.
I was referring to this tutorial, http://blogs.developpeur.org/kookiz/archive/2011/11/13/wp7-upload-a-file-to-dropbox-using-reactiveoauth-wp7.aspx.
I have followed all the steps, but VS shows an error saying
Error 1 'DropBoxTest.MainPage' does not contain a definition for
'RequestToken' and no extension method 'RequestToken' accepting a
first argument of type 'DropBoxTest.MainPage' could be found (are you
missing a using directive or an assembly reference?)
I have added all the mentioned classes and references. Could anyone please have a look and help?
You should take a look to Spring.NET Dropbox.
It supports WP7 and provides a sample too.
http://www.springframework.net/social-dropbox/
I can't figure out why I suddenly get these compile errors. Let's go through the steps I take:
1) I create a new MVC3 ASP.NET project (C#) using the Razor View engine
2) In my Models folder, I add an ADO.NET Entity Data Model, connect it to my database, and name it Database.edmx
3) I open my Database.edmx and select Add code generation item. I then add a Selft-Tracking Entity Generator and call it Model.tt
Everything is automaticly generated. When I hit build however, I get following compile errors:
Error 1 Cannot implicitly convert type 'System.Type' to 'MyOwnProject.Models.Type'
Error 2 'MyOwnProject.Models.Type' does not contain a definition for 'IsValueType' and no extension method 'IsValueType' accepting a first argument of type 'MyOwnProject.Models.Type' could be found (are you missing a using directive or an assembly reference?)
Error 3 'MyOwnProject.Models.Type' does not contain a definition for 'IsGenericType' and no extension method 'IsGenericType' accepting a first argument of type 'MyOwnProject.Models.Type' could be found (are you missing a using directive or an assembly reference?)
Error 4 'MyOwnProject.Models.Type' does not contain a definition for 'GetGenericTypeDefinition' and no extension method 'GetGenericTypeDefinition' accepting a first argument of type 'MyOwnProject.Models.Type' could be found (are you missing a using directive or an assembly reference?)
Error 5 Cannot implicitly convert type 'System.Type' to 'MyOwnProject.Models.Type'
Error 6 'MyOwnProject.Models.Type' does not contain a definition for 'FullName' and no extension method 'FullName' accepting a first argument of type 'MyOwnProject.Models.Type' could be found (are you missing a using directive or an assembly reference?)
Error 7 'MyOwnProject.Models.Type' does not contain a definition for 'FullName' and no extension method 'FullName' accepting a first argument of type 'MyOwnProject.Models.Type' could be found (are you missing a using directive or an assembly reference?)
To me, this makes no sense at all. I've created new projects with a database this way a dozen times and now, all of a sudden, I get these compile errors. It doesn't make a difference what I name the database, edmx or models. It also makes no difference wether the database sits in the App_Data folder, or on an external location on my hard drive.
Does anyone have any idea why this is failing? Thanks.
It looks like there is a table TYPES in your database that results in an entity class Type. This class hides the class System.Type. Change the name of your entity to something else, e.g. TypeEntity.
Don't call your entity "Type". There's a really, really important type in .NET already called Type. You will only cause yourself pain with this name. Pick a name which isn't the same as a built-in, fundamental type name.
I've heard nice stuff about the NavigateToString() C# method, but i can't seem to be able to use it =(
I have a System.Windows.Forms.WebBrowser in a panel, and when i try to call NavigateToString() it says:
"Error: 'System.Windows.Forms.WebBrowser' does not contain a definition for 'NavigateToString' and no extension method 'NavigateToString' accepting a first argument of type 'System.Windows.Forms.WebBrowser' could be found (are you missing a using directive or an assembly reference?)
C:\Users\Name\documents\visual studio 2010\Projects\TestPHPNavigateToString\TestPHPNavigateToString\Form1.cs TestPHPNavigateToString"
I didn't find anyone with the same issue oO, is there a particular dll i should add a reference to?.
I have vs2010 with .Net FrameWork 4.0, i just reinstalled it just to be sure, but it feels like I'm missing something here =o
Thanks.
The method NavigateToString is available on System.Windows.Controls.WebBrowser and not System.Windows.Forms.WebBrowser
http://msdn.microsoft.com/en-us/library/system.windows.controls.webbrowser.navigatetostring.aspx
-> PresentationFramework (in PresentationFramework.dll)
Do you have this reference?