barbary's Profile
Reputation: 0
Apprentice
- Group:
- New Members
- Active Posts:
- 13 (0.05 per day)
- Joined:
- 13-August 12
- Profile Views:
- 548
- Last Active:
Nov 05 2012 02:44 AM- Currently:
- Offline
Previous Fields
- Country:
- GB
- OS Preference:
- Windows
- Favorite Browser:
- Internet Explorer
- Favorite Processor:
- Intel
- Favorite Gaming Platform:
- PC
- Your Car:
- Who Cares
- Dream Kudos:
- 0
Posts I've Made
-
In Topic: why i dont get exception ?
Posted 29 Oct 2012
I'll try to explain.
The HashCode is not the key. The object is the key and the HashCode just helps the hashtable locate the value.
So this is valid
First obj1 = new First("mohamed"); First obj2 = new First("Ali"); Second Nobj = new Second(1); Hashtable ht = new Hashtable(); ht[obj1] = Nobj; ht[obj2] = Nobj; ht.Add(new First("mohamed"), Nobj); ht.Add(new First("Ali"), Nobj);
This is not
First obj1 = new First("mohamed"); First obj2 = new First("Ali"); Second Nobj = new Second(1); Hashtable ht = new Hashtable(); ht[obj1] = Nobj; ht[obj2] = Nobj; ht.Add(obj1, Nobj); ht.Add(obj2, Nobj);
However adding this to First will make your orginal example throw an exception
public override bool Equals(object obj) { return this.GetHashCode() == obj.GetHashCode(); }
However this probably just shows that your using hashtable in an inapproriate way, I don't know because you haven't said what your trying to do. Also Dictionary<T,T> is probably better than a hashtable for doing this. -
In Topic: Reading Output From Process And Process Issues?
Posted 16 Aug 2012
Skydivers answer is correct way to do this.
To update the textbox in the event you will need to do the update on the GUI thread.
Read that example and then come back if you need more help. -
In Topic: Reading Output From Process And Process Issues?
Posted 16 Aug 2012
The way your accessing the stream response will always make it appear as if the output all comes at the end.
What you need to do is read the stream a bit at a time as the process happends
while (sr.Peek() >= 0) { this.TxtBxOutPutFFMPEG.Text += sr.ReadLine; }
without knowing the return types its difficult to know if I have typed this correctely.
Hope it helps. -
In Topic: C# Game Developers?
Posted 14 Aug 2012
I actualy signed up just to throw my hat into the ring.
I'm a very experinced c# developer (12 years) who has dabbled with XNA at home to produce simple 2D games.
I have some spare time and I'm looking for a project something a bit different from what I normaly code and game code could be it.
I'd only be interested in the coding part and I have no talent for anything related to graphics anyway.
Email me if you have something actualy being built and would like a hand. -
In Topic: IsNumeric in C#
Posted 13 Aug 2012
shyams, on 04 August 2011 - 11:26 PM, said:VB provides the IsNumeric function to test whether a string contains a valid numeric value or not. C# has no such function leaving you to write your own.
public static bool IsNumeric(string text) { return Regex.IsMatch(text,"^\\d+$"); }
This is the only really correct answer. As somebody else said if you have a realy long number then int.TryParse will fail for that.
However you then go on to say that handling negitive numbers is a plus which would imply that some non numeric charaters are going to be allowed so its best you think about your use cases and decided which is best.
My Information
- Member Title:
- New D.I.C Head
- Age:
- 39 years old
- Birthday:
- June 18, 1973
- Gender:
-
- Years Programming:
- 20
- Programming Languages:
- c# .net
Contact Information
- E-mail:
- Click here to e-mail me
Friends
barbary hasn't added any friends yet.
|
|


Find Topics
Find Posts
View Reputation Given
|
Comments
barbary has no profile comments yet. Why not say hello?