|
I thought the generics were old news. I'm interested to know what is meant by 'iterators' though - do we glean from this that there will be an STL like container collection in the next version as well ? Is there anywhere we can see some examples of the syntax of the new features ?
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Iterators are a way to make writing foreach-able classes easier. It's fairly easy currently to do this for something like an array, but doing it for a tree requires some gymnastics. With iterators, the compiler does the gymnastics for you.
|
|
|
|
|
Eric Gunnerson (msft) wrote:
For more information - and to sign up to receive email when we have specs ready - visit http://www.csharp.net
Eric, the link there for demo files is broken. The powerpoint file downloads OK though.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Are they worth the download? I dont feel like downloading PPTView and installing it....
"I dont have a life, I have a program."
|
|
|
|
|
I apologize for that. A file was supposed to get copied to the website, and it didn't. It should be fixed presently...
|
|
|
|
|
Well, you know, I'd rant and rave about Microsoft letting me down again, but last time I checked, I was not perfect either ( although damn close, let me add )......
Thanks - I'll check again later today. I'm really excited about this stuff, I must say, especially how verbose the generic syntax isn't.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
|
Eric Gunnerson (msft) wrote:
Anonymous Delegates
I read elsewhere about Anonymous Methods instead. Are they one and the same or is there a subtle difference?
ASP.NET can never fail as working with it is like fitting bras to supermodels - it's one pleasure after the next - David Wulff
|
|
|
|
|
Ok scratch that, just learnt that it's "Anonymous methods via delegates"
ASP.NET can never fail as working with it is like fitting bras to supermodels - it's one pleasure after the next - David Wulff
|
|
|
|
|
Anonymous Methods is the proper term - I made a mistake in my posting.
|
|
|
|
|
Without wanting to start a VB vs VC# troll, is this the split between these 2 languages that I've been hearing about from your South African colleagues?
Either way, you guys are doing great work.
Cheers,
Simon
"VB.NET ... the STD of choice", me, internal company memo
|
|
|
|
|
C# and VB .NET are targetted at slightly different audiences, and that changes the stack rank of features. Many features are interesting to both groups, but the importance of the feature may be high in one group and low in another. Each of the product groups decides where to devote their resources for a given release.
I don't know what the plans are for VB .NET WRT generics. I do know that generics have always been one of the top requests from C# customers, and that's why we're doing them.
|
|
|
|
|
Thanks, Eric.
That clears things up for me.
Cheers,
Simon
"From now on, if rogue states want to buy weapons of mass destruction, they're going to have to go on eBay," Mr. Bezos said.
|
|
|
|
|
I have a situation in which data from a database is extracted via ExecuteReader(), with all of this taking place in the Page_Load event in a codebehind file. The data is then stored in several variables whos contents are displayed on different parts of the page. I now would like to add a usercontrol to make updating the navigation panel easier. However part of the navigation require key data that was extracted from the database.So...
Is there anyway to give 'myusercontrol.ascx' on 'somepage.aspx' access to variables in 'somepages-codebehind.cs' ???
It would be extremely convenient if there were, which is why I'm asking
Otherwise I will have to rewrite the entire way data is access
Thanks for the help.
********************
* SteveMcLenithan
* steve@steve-mac.com
* http://steve-mac.com
********************
|
|
|
|
|
ASP.NET forum question! And no dont double it there too!
Steve McLenithan wrote:
Is there anyway to give 'myusercontrol.ascx' on 'somepage.aspx' access to variables in 'somepages-codebehind.cs' ???
You just need to mark the members (variables) protected public ( ) and then u can use the USerControls Page property to get the page, cast it somepage and whala!
"I dont have a life, I have a program."
|
|
|
|
|
|
I have a rich text control....and a rich text document to display in that control. Is there any easy way to bind that file to the control, or do I have to access the file and stream it into the control at form load?
Thanks
_____________________________________________
I have a tendancy to where my mind on my sleeve I have a habit of losing my shirt...
|
|
|
|
|
Use the RichTextBox 's LoadFile method, there you can give it a filename or a Stream to load from.
If you have the document loaded in memory as a string object then you can just set the Rtf property of the control (or if its unformatted text then the normal Text property will do).
James
- out of order -
|
|
|
|
|
Wow! Thanks. I looked for some kind of binding control at the design stage, rather than methods at runtime. This works great, and SOOOO simple. Thanks.
_____________________________________________
I have a tendancy to where my mind on my sleeve I have a habit of losing my shirt...
|
|
|
|
|
I use the code described below to one-way hash a supplied user's password to verify it against the one-way hashed password stored in a database.
While the code works and provides the functionality I am looking for I am not convinced that it does it in the quickest/most elegant/most sensible/safest way.
Any ideas for improvement?
char[] password = new char[50];
System.IO.StringReader reader = new System.IO.StringReader(this.textBoxPassword);
reader.Read(password, 0, 50);
byte[] bPassword = new byte[50];
for(int i = 0; i < 50; i++)
{
bPassword[i] = (byte)password[i]);
}
System.Security.Cryptography.SHA1 shaM = new System.Security.Cryptography.SHA1Managed();
byte[] hash = shaM.ComputeHash(bPassword);
char[] cHash = new char[hash.Length];
for(int i = 0; i < hash.Length; i++)
{
cHash[i] = (char)hash[i];
}
string hashword = new string(cHash);
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
You're right. It isn't the best way...
SHA1 shaM = new SHA1Managed();
UnicodeEncoding enc = new UnicodeEncoding();
byte[] original = enc.GetBytes(Text);
byte[] converted = shaM.ComputeHash(original);
Text = enc.GetString(converted);
The UnicodeEncoding class is in the System.Text namespace. I always do something that I think shouldn't take that much...then I find out how I could have saved myself a bunch of time and heartache by just looking for something in the FCL that would do it for me.
Oh, and you aren't supposed to create strings like this:
string hashword = new string(cHash); You should do it like this:
string hashword = cHash; Or, you should probably just use cHash instead of creating a new string.
You will now find yourself in a wonderous, magical place, filled with talking gnomes, mythical squirrels, and, almost as an afterthought, your bookmarks
-Shog9 teaching Mel Feik how to bookmark
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past.
-Chris Maunder
|
|
|
|
|
Thanks very much I knew there had to be a better way!
P.S. What's wrong with using one of the string constructors to create a string?
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
I dunno. But Jeffery Richter says not to. So you know what I don't do? Use the String constructor. In Applied Microsoft .NET Framework Programming, page 253, he says:
"In C#, you can't use the new operator to construct a String object..."
Go figure...
You will now find yourself in a wonderous, magical place, filled with talking gnomes, mythical squirrels, and, almost as an afterthought, your bookmarks
-Shog9 teaching Mel Feik how to bookmark
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past.
-Chris Maunder
|
|
|
|
|
David Stone wrote:
"In C#, you can't use the new operator to construct a String object..."
The code I gave does work as it should do so, can't is a bit misleading; shouldn't may have some merits, though.
David Stone wrote:
Jeffery Richter says not to
If Jeffrey says so, then I will cease this instant. I keep meaning to get the book or something similar, but haven't quite got round to it yet. I'm too busy blundering about unguided
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
AHHH. Damn and blast. David beat me to it.
Yeah, hes right. Yours isn't the best way of doing it.
public string test2(string strBoxPassword)
{
byte[] bPassword = System.Text.Encoding.Default.GetBytes(strBoxPassword);
System.Security.Cryptography.SHA1 shaM = new System.Security.Cryptography.SHA1Managed();
byte[] hash = shaM.ComputeHash(bPassword);
return System.Text.Encoding.Default.GetString(hash);
}
Note that this and Davids reply are pretty similar except he excplicitly speficies the Unicode encoder. However, please note that both these methods WILL NOT return the same hash as your old method. The reason beeing is that you hard code 50 characters in the source byte array no matter what the actual length is. Our methods only hash the actual contents of the data and no extra trailing bytes.
Therefore if you already have hashes in your DB based on the originial code your probably going to have to either stick with what you have or re generate all the hashes...
Pete
Insert Sig. Here!
|
|
|
|