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

C#

 
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 
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 
I found one workaround, but I still wonder if there is a bether way of doing this. Here is a solution that works:

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


and the checker class:

public class checker : IEqualityComparer<image>
   {



       #region IEqualityComparer<image> Members

       public bool Equals(Image x, Image y)
       {
           if (x.imageID == y.imageID)
               return true;
           else
           {
               return false;
           }
       }

       public int GetHashCode(Image obj)
       {
           return obj.GetHashCode();
       }

       #endregion
   }</image></image>


And I am still verry curious to why this dont work:

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");


I see no reason why these two instances should not equal eachother.

Here is the autogenerated Image class if anyone wants to know how that looks:

[Table(Name="dbo.Images")]
	public partial class Image
	{
		
		private int _imageID;
		
		private int _systemID;
		
		private string _name;
		
		private string _description;
		
		private string _searchWords;
		
		private System.DateTime _created;
		
		private System.Nullable<system.datetime> _uppdated;
		
		public Image()
		{
		}
		
		[Column(Storage="_imageID", AutoSync=AutoSync.Always, DbType="Int NOT NULL IDENTITY", IsDbGenerated=true)]
		public int imageID
		{
			get
			{
				return this._imageID;
			}
			set
			{
				if ((this._imageID != value))
				{
					this._imageID = value;
				}
			}
		}
		
		[Column(Storage="_systemID", DbType="Int NOT NULL")]
		public int systemID
		{
			get
			{
				return this._systemID;
			}
			set
			{
				if ((this._systemID != value))
				{
					this._systemID = value;
				}
			}
		}
		
		[Column(Storage="_name", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
		public string name
		{
			get
			{
				return this._name;
			}
			set
			{
				if ((this._name != value))
				{
					this._name = value;
				}
			}
		}
		
		[Column(Storage="_description", DbType="NVarChar(2000)")]
		public string description
		{
			get
			{
				return this._description;
			}
			set
			{
				if ((this._description != value))
				{
					this._description = value;
				}
			}
		}
		
		[Column(Storage="_searchWords", DbType="NVarChar(2000)")]
		public string searchWords
		{
			get
			{
				return this._searchWords;
			}
			set
			{
				if ((this._searchWords != value))
				{
					this._searchWords = value;
				}
			}
		}
		
		[Column(Storage="_created", DbType="DateTime NOT NULL")]
		public System.DateTime created
		{
			get
			{
				return this._created;
			}
			set
			{
				if ((this._created != value))
				{
					this._created = value;
				}
			}
		}
		
		[Column(Storage="_uppdated", DbType="DateTime")]
		public System.Nullable<system.datetime> uppdated
		{
			get
			{
				return this._uppdated;
			}
			set
			{
				if ((this._uppdated != value))
				{
					this._uppdated = value;
				}
			}
		}
	}</system.datetime></system.datetime>

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 
GeneralRe: Lockless Queue in C# slower than Locked Queue in C# Pin
Daniel Grunwald7-Jan-09 2:37
Daniel Grunwald7-Jan-09 2:37 

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.