.NET Framework? What .NET Framework?
-
I was rewriting an application when I came across the following snippit:
System.Text.UTF8Encoding encoder8 = new System.Text.UTF8Encoding(); System.Text.Decoder utf8Decode = encoder8.GetDecoder(); byte[] todecode_byte8 = Convert.FromBase64String(_body); int charCount8 = utf8Decode.GetCharCount(todecode_byte8, 0, todecode_byte8.Length); char[] decoded_char8 = new char[charCount8]; utf8Decode.GetChars(todecode_byte8, 0, todecode_byte8.Length, decoded_char8, 0); _body = new String(decoded_char8);
Obviously, the culprit ".NET" programmer responsible kinda missed the alternative solution:_body = Encoding.UTF8.GetString( Convert.FromBase64String( _body ) );
And I wish this was the only occurrence of this.. -
I was rewriting an application when I came across the following snippit:
System.Text.UTF8Encoding encoder8 = new System.Text.UTF8Encoding(); System.Text.Decoder utf8Decode = encoder8.GetDecoder(); byte[] todecode_byte8 = Convert.FromBase64String(_body); int charCount8 = utf8Decode.GetCharCount(todecode_byte8, 0, todecode_byte8.Length); char[] decoded_char8 = new char[charCount8]; utf8Decode.GetChars(todecode_byte8, 0, todecode_byte8.Length, decoded_char8, 0); _body = new String(decoded_char8);
Obviously, the culprit ".NET" programmer responsible kinda missed the alternative solution:_body = Encoding.UTF8.GetString( Convert.FromBase64String( _body ) );
And I wish this was the only occurrence of this..Could have been me - I remember myself digging through that Encoding documentation in MSDN - it is really badly documented, no concepts, just a bunch of classes and members. (IIRC I had to serialize to/from base64, and it was driving me crazy)
Developers, Developers, Developers, Developers, Developers, Developers, Velopers, Develprs, Developers!
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
Linkify!|Fold With Us! -
Could have been me - I remember myself digging through that Encoding documentation in MSDN - it is really badly documented, no concepts, just a bunch of classes and members. (IIRC I had to serialize to/from base64, and it was driving me crazy)
Developers, Developers, Developers, Developers, Developers, Developers, Velopers, Develprs, Developers!
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
Linkify!|Fold With Us!Oh I couldn't agree more on the level of documentation on this (or the lack thereof). If I were writing this, a little voice in the back of my head would go 'Come on man, there's an easier way to do this, right?'. And I've taught myself to listen to that voice ;) That, and using the Convert class A LOT :p
-
Oh I couldn't agree more on the level of documentation on this (or the lack thereof). If I were writing this, a little voice in the back of my head would go 'Come on man, there's an easier way to do this, right?'. And I've taught myself to listen to that voice ;) That, and using the Convert class A LOT :p
ErikDD wrote:
a little voice in the back of my head would go 'Come on man, there's an easier way to do this, right?'. And I've taught myself to listen to that voice
I've got that voice a lot lately... but obviously, it only tells YOU about the solution :cool:
Developers, Developers, Developers, Developers, Developers, Developers, Velopers, Develprs, Developers!
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
Linkify!|Fold With Us! -
ErikDD wrote:
a little voice in the back of my head would go 'Come on man, there's an easier way to do this, right?'. And I've taught myself to listen to that voice
I've got that voice a lot lately... but obviously, it only tells YOU about the solution :cool:
Developers, Developers, Developers, Developers, Developers, Developers, Velopers, Develprs, Developers!
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
Linkify!|Fold With Us!Ooo I feel special :cool: