Click here to Skip to main content
15,902,492 members
Home / Discussions / C#
   

C#

 
QuestionEfficient way to check if web resource/file exists? Pin
Dominic Pettifer25-Jun-07 2:43
Dominic Pettifer25-Jun-07 2:43 
AnswerRe: Efficient way to check if web resource/file exists? [modified] Pin
I.explore.code25-Jun-07 3:25
I.explore.code25-Jun-07 3:25 
GeneralRe: Efficient way to check if web resource/file exists? Pin
User 665825-Jun-07 3:28
User 665825-Jun-07 3:28 
AnswerRe: Efficient way to check if web resource/file exists? Pin
I.explore.code25-Jun-07 19:49
I.explore.code25-Jun-07 19:49 
GeneralRe: Efficient way to check if web resource/file exists? Pin
Dominic Pettifer25-Jun-07 22:03
Dominic Pettifer25-Jun-07 22:03 
Questiondatagrid with row header Pin
Sunshine Always25-Jun-07 2:37
Sunshine Always25-Jun-07 2:37 
QuestionParsing a log file using regular expressions Pin
salon25-Jun-07 2:26
salon25-Jun-07 2:26 
AnswerRe: Parsing a log file using regular expressions Pin
User 665825-Jun-07 3:44
User 665825-Jun-07 3:44 
GeneralRe: Parsing a log file using regular expressions Pin
salon25-Jun-07 4:00
salon25-Jun-07 4:00 
GeneralRe: Parsing a log file using regular expressions Pin
User 665825-Jun-07 4:18
User 665825-Jun-07 4:18 
QuestionWhy causes the change of the Location the change of the size Pin
MarkPhB25-Jun-07 2:24
MarkPhB25-Jun-07 2:24 
Questionhow can I test my FTP application? Pin
Mostafa Siraj25-Jun-07 2:04
Mostafa Siraj25-Jun-07 2:04 
AnswerRe: how can I test my FTP application? Pin
originSH25-Jun-07 2:12
originSH25-Jun-07 2:12 
AnswerRe: how can I test my FTP application? Pin
Carmine_XX25-Jun-07 7:18
Carmine_XX25-Jun-07 7:18 
QuestionT9 dictionary in c# Pin
seeng25-Jun-07 1:43
seeng25-Jun-07 1:43 
AnswerRe: T9 dictionary in c# Pin
Pete O'Hanlon25-Jun-07 1:55
mvePete O'Hanlon25-Jun-07 1:55 
AnswerRe: T9 dictionary in c# Pin
Christian Graus25-Jun-07 2:10
protectorChristian Graus25-Jun-07 2:10 
AnswerRe: T9 dictionary in c# Pin
Pete O'Hanlon25-Jun-07 2:19
mvePete O'Hanlon25-Jun-07 2:19 
AnswerRe: T9 dictionary in c# Pin
Dave Kreskowiak25-Jun-07 4:47
mveDave Kreskowiak25-Jun-07 4:47 
GeneralRe: T9 dictionary in c# Pin
Not Active25-Jun-07 5:11
mentorNot Active25-Jun-07 5:11 
AnswerRe: T9 dictionary in c# Pin
Dan Neely25-Jun-07 5:21
Dan Neely25-Jun-07 5:21 
QuestionObject as disctionary key Pin
AndrusM25-Jun-07 1:36
AndrusM25-Jun-07 1:36 
I need to implement object in-memory cache .

Each object id can be composed from several string, integer and decimal type values.

ContainsKey does not find existing key in this case.

How to force ContainsKey to compare object contents and find key?
Should i use binaryformatter to serialize CacheKey, overload CacheKey == operator or any other idea ?

To reproduce,

run the code.

Observed:

Key not found

Expected:

Key found


using System.Collections.Generic;<br />
<br />
class test {<br />
	struct CacheKey {<br />
		object Key;<br />
		public CacheKey(object key) {<br />
			Key = key;<br />
		}<br />
	}<br />
<br />
	static Dictionary<CacheKey, object> Cache =<br />
				new Dictionary<CacheKey, object>();<br />
<br />
	static void Main() {<br />
		CacheKey key = new CacheKey(new object[] { "test1", 1 });<br />
		Cache.Add(key, "");<br />
		CacheKey key2 = new CacheKey(new object[] { "test1", 1 });<br />
		if (!Cache.ContainsKey(key2))<br />
			System.Windows.Forms.MessageBox.Show("Key not found");<br />
		else<br />
			System.Windows.Forms.MessageBox.Show("Key found");<br />
	}<br />
}


Andrus

AnswerRe: Object as disctionary key Pin
originSH25-Jun-07 1:48
originSH25-Jun-07 1:48 
GeneralRe: Object as disctionary key Pin
AndrusM25-Jun-07 2:36
AndrusM25-Jun-07 2:36 
GeneralRe: Object as disctionary key Pin
Pete O'Hanlon25-Jun-07 3:01
mvePete O'Hanlon25-Jun-07 3:01 

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.