Click here to Skip to main content
15,914,225 members
Home / Discussions / C#
   

C#

 
AnswerRe: .NET Remoting - Closing Channels. Pin
DaveyM697-Jan-09 2:17
professionalDaveyM697-Jan-09 2:17 
QuestionRe: .NET Remoting - Closing Channels. Pin
stammailbox7-Jan-09 2:36
stammailbox7-Jan-09 2:36 
QuestionDatabase Connection Pin
anveshvm6-Jan-09 22:08
anveshvm6-Jan-09 22:08 
AnswerRe: Database Connection Pin
N a v a n e e t h6-Jan-09 22:28
N a v a n e e t h6-Jan-09 22:28 
GeneralRe: Database Connection Pin
anveshvm6-Jan-09 23:03
anveshvm6-Jan-09 23:03 
GeneralRe: Database Connection Pin
N a v a n e e t h6-Jan-09 23:22
N a v a n e e t h6-Jan-09 23:22 
GeneralRe: Database Connection Pin
anveshvm6-Jan-09 23:28
anveshvm6-Jan-09 23:28 
QuestionProblem with Linq Contains or comparing two instances of the dbml generated class of my sql table Pin
Jarl Johnny Jacobsen6-Jan-09 21:51
Jarl Johnny Jacobsen6-Jan-09 21:51 
Hi.
I am currently learning Linq and have some trouble with the Linq Contains function.

Here is what I first tried:
DataClasses1DataContext con = new DataClasses1DataContext(@"myconstring");
bool contains = con.Images.Contains(con.Images.First(n => n.imageID == 2));


I was pretty shure this would work but contains became false.

I then tried this:
Image myImg = con.Images.First(n => n.imageID == 2);
Image myImg3 = con.Images.First(n => n.imageID == 2);

if (myImg.Equals(myImg3))
                Console.WriteLine("hurra");


But this did not work either. The two instances did not equal eachother.
I continued to try with this:

Image myImg2 = new Image
                               {
                                   created = DateTime.Parse("23.05.2008 00:00:00"),
                                   description = "Jalla",
                                   imageID = 2,
                                   name = "test",
                                   searchWords = "halla",
                                   systemID = 1
                               };
            Image myImg4 = new Image
            {
                created = DateTime.Parse("23.05.2008 00:00:00"),
                description = "Jalla",
                imageID = 2,
                name = "test",
                searchWords = "halla",
                systemID = 1
            };

if (myImg2.Equals(myImg4))
                Console.WriteLine("hurra");


But still they did not equal eachother. Only way I got this to work was by adding my img instances to a Array of Images[] and then do contains on this.

Image[] imgs = {myImg, myImg2, myImg3, myImg4};
bool contains = imgs.Contains(myImg2);


This gives contains a true value. So then I tought that this should work:

bool contains = con.Images.ToList().Contains(con.Images.First(n => n.imageID == 2));


But still contains is set to false.

So I am stumped. Anyone got anny sugestions or hints to why this does not work?
AnswerRe: Problem with Linq Contains or comparing two instances of the dbml generated class of my sql table Pin
Jarl Johnny Jacobsen6-Jan-09 22:18
Jarl Johnny Jacobsen6-Jan-09 22:18 
Question"Another" one automation error... - part 2 [modified] Pin
Member 28952166-Jan-09 21:50
Member 28952166-Jan-09 21:50 
QuestionRead pdf file and write content in a doc file with images preserved Pin
inzibharti6-Jan-09 21:24
inzibharti6-Jan-09 21:24 
AnswerRe: Read pdf file and write content in a doc file with images preserved Pin
lawrenceinba6-Jan-09 21:29
lawrenceinba6-Jan-09 21:29 
GeneralRe: Read pdf file and write content in a doc file with images preserved Pin
inzibharti6-Jan-09 23:50
inzibharti6-Jan-09 23:50 
GeneralRe: Read pdf file and write content in a doc file with images preserved Pin
inzibharti8-Jan-09 1:54
inzibharti8-Jan-09 1:54 
AnswerRe: Read pdf file and write content in a doc file with images preserved Pin
Wendelius7-Jan-09 1:11
mentorWendelius7-Jan-09 1:11 
GeneralRe: Read pdf file and write content in a doc file with images preserved Pin
inzibharti7-Jan-09 21:22
inzibharti7-Jan-09 21:22 
GeneralRe: Read pdf file and write content in a doc file with images preserved Pin
Wendelius7-Jan-09 21:47
mentorWendelius7-Jan-09 21:47 
GeneralRe: Read pdf file and write content in a doc file with images preserved Pin
inzibharti7-Jan-09 22:26
inzibharti7-Jan-09 22:26 
GeneralRe: Read pdf file and write content in a doc file with images preserved Pin
Wendelius7-Jan-09 22:30
mentorWendelius7-Jan-09 22:30 
QuestionLockless Queue in C# slower than Locked Queue in C# Pin
Cyrilix6-Jan-09 20:52
Cyrilix6-Jan-09 20:52 
GeneralRe: Lockless Queue in C# slower than Locked Queue in C# Pin
Luc Pattyn6-Jan-09 22:58
sitebuilderLuc Pattyn6-Jan-09 22:58 
GeneralRe: Lockless Queue in C# slower than Locked Queue in C# Pin
Cyrilix6-Jan-09 23:28
Cyrilix6-Jan-09 23:28 
GeneralRe: Lockless Queue in C# slower than Locked Queue in C# Pin
Luc Pattyn6-Jan-09 23:36
sitebuilderLuc Pattyn6-Jan-09 23:36 
GeneralRe: Lockless Queue in C# slower than Locked Queue in C# Pin
Cyrilix7-Jan-09 1:18
Cyrilix7-Jan-09 1:18 
GeneralRe: Lockless Queue in C# slower than Locked Queue in C# Pin
Luc Pattyn7-Jan-09 1:58
sitebuilderLuc Pattyn7-Jan-09 1:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.