Subject: Memorial Weekend Recap

From: DocOz Episode Recap <[email-masked]>
Date: Tue, 27 May 2014 12:44:05 -0700

Doc Oz Episode: May 27 Episode Recap
The Doctors & DocOz helping RESCUE people from weight-Gain

Posted - 

Were you feeling self-conscious at Memorial Day Weekend Festivities?
Did you not loose the lbs- that you had planned on?

Oprah and Other Celebrities Lose 4 lbs- / Week of Belly Fat With 
This Shocking Video Shows you how to loose 1 lb a day.

- No Work-Out Necessary
- No Starvation 

View Video Clip: http://www.oebonetae.com/droz/episode/meltingfat.video

- The Doctors Show & DocOz Team

Follow The Doctors on Facebook | Twitter | Pintrest | 
http://www.oebonetae.com/droz/episode/meltingfat.video

to modify message settings w/ Update Notice Messages
(write) 118 Kecks Lane Ruff Dale, PA 15679 or http://www.oebonetae.com/93hg.gkri

var is a new keyword in C# 3.0 (.NET 3.5) that says I don't feel like typing out the type of this variable (or don't know it), I want the compiler to infer it for me. You can only use it with assignment in the same statement as the declaration.   Mike Brown Oct 21 '08 at 23:26
@Mike Brown: Hmmm, unknown variable types. Sounds like we're going back to the dark days of typeless and variant languages. shiver   Ian Boyd Jun 1 '10 at 17:45
The variable is still typed in the same way as other variables. It's just that you allow the compiler to infer the type from the RHS of the assignment (it can only be used with assignments, you can't just do var foo;). This is particularly important with LINQ, as the returned types can be quite complex, and not easy to work out yourself.   Matt Sach Jun 3 '10 at 14:36 @Matt Sach: It's fine as long as the type inferred by the compiler is the type i inferred when i wrote it.   Ian Boyd Oct 1 '10 at 21:31@IanBoyd: Graphain is right, in C#, var is what you need when you may get different types from different queries. but if what you are shivering about is called dynamic typing, then I don't get your point.   Luka Ramishvili Nov 11 '11 at 7:02It's simply wrong to think about programming language development as evolution. There were no dark days back then, because one of the most powerful languages is second oldest (not to mention others). so bad languages aren't neccessarily from the past
 .   Luka Ramishvili Nov 11 '11 at 7:09
@Haacked - Nice one. Definitely GetNames() in his circumstance. I've got a slightly different situation. I have a [Flags] enum for permissions. A class has a property of this enum type, and its value may be one or more flags... what i am trying to do is parse the individual flags out of this value, so that i can enumerate over them. Phil? Anyone else?   one.beat.consumeEDIT: I know a cheeseball way... converting the multi-flag enum value to string, splitting it, and parsing each string back to a single-flag enum value... but that is nasty. there's got to be a cleaner, more simple method.   one.beat.consumer Dec 1 '11 at 1:34
+1 for novel use of generics and linq queries. Although i would smack anyone who used it in practice.   Ian Boyd Feb 2 '12 at 19:02Ian, thanks for the +1. I am new to C# and I am keen explore and learn best practice. I do use it in practice; why I deserve a smack?   James Feb 3 '12 at 11:46
Careful with using generics like this. If you try to use EnumLoop with some type that is not an enum, it will compile fine, but throw an exception at runtime.   svick Feb 6 '12 at 12:09Thank you svick. Runtime exceptions will actually occur with the other answers on this page... except this one because I have added "where Key : struct, IConvertible" so that you get a compile time error in most cases.   James Feb 7 '12 at 12:13
No, GetValues() is called only once in the foreach. Great, I didn't even know that keyword. Always nice to learn something new. Thank you! Does it always return a reference to the same object, or does it create a new instance each time the default statement is called? I haven't found anything on the net about this so far, but if it creates a new instance every time, it kind of defeats the purpose I was looking for (having a one-liner ^^).   Mallox Jul 8 '10 at 6:48.GetValue(new T())?   Jason Miesionczek Jun 21 '11 at 2:33
Wouldn't this create a new instance for every iteration over the enumeration?   Mallox Jun 28 '11 at 15:04
-1 for "supports type checking at compile time:". What type checking? This would work for any new() T. Also, you dont need new T() at all, you can select just the static fields alone and doue(null). See Aubrey's answer. 
Your confusion over the role of encoding makes me wonder if this is the right question. Why are you trying to convert a string to a byte array? What are you going to do with the byte array?   Greg D Jan 23 '09 at 13:56
I'm going to encrypt it. I can encrypt it without converting but I'd still like to know why encoding comes to play here. Just give me the bytes is what I say.   Agnel Kurian Jan 23 '09 at 13:57
If you're encrypting it, then you'll still have to know what the encoding is after you decrypt it so that you know how to reinterpret those bytes back into a string.   Greg D Jan 23 '09 at 14:00
Every string is stored as an array of bytes right? Why can't I simply have those bytes?   Agnel Kurian Jan 23 '09 at 14:05Have a look at Jon Skeet's answer in a post with the exact question. It will explain why you depend on encoding.   Igal Tabachnik Jan 23 '09 at 14:15
I think Anthony is trying to address the fundamental disconnect in <300 chars. You're assuming some consistent internal representation of a string, when in fact that representation could be anything. To create, and eventually decode, the bytestream, you must choose an encoding to use.   Greg D Jan 23 '09 at 16:38
"A string is an array of chars, where a char is not a byte in the .Net world" Alright, but regardless of the encoding, each character maps to one or more bytes. Can I have those bytes please without having to specify an encoding?   Agnel Kurian Mar 4 '09 at 5:51The encoding is what maps the characters to the bytes. For example, in ASCII, the letter 'A' maps to the number 65. In a different encoding, it might not be the same. The high-level approach to strings taken in the .NET framework makes this largely irrelevant, though (except in this case).   Lucas Jones Apr 13 '09 at 14:13
ul 22 '09 at 11:30To play devil's advocate: If you wanted to get the bytes of an in-memory string (as .NET uses them) and manipulate them somehow (i.e. CRC32), and NEVER EVER wanted to decode it back into the original string...it isn't straight forward why you'd care about encodings or how you choose which one to use.   Greg Dec 1 '09 at ay-c/   Michael Buen Jul 9 '10 at 0:08
possible duplicate of How do you convert a string to a byte arraydamjcooper Jul 6 '13 at 11:47
@AgnelKurian, A char is a struct that just happens to currently store values as a 16-bit number (UTF-16). What you're really asking (get the character bytes) isn't theoretically possible because it doesn't theoretically exist. A char or string has no Encoding by definition. What if the memory representation changed to UTF-32? Your "get the bytes, shove them back" would fail due to Encoding because you avoided Encoding. So "Why this dependency on enDepend on Encoding so your code is dependable.   Travis Aug 5 '13 at 22:04
  	  	@Bevan because the necessary errata to go with that link won't fit into a 600-character comment, and would beoff-topic as an answer?   Jon Hanna Jan 6 at 14:04
@JonHanna enlighten us. A blog post wouldn't be out of place in this case.   Agnel Kurian Jan 7 at 10:48
@AgnelKurian it was seeing incorrect things cited was one of my reasons fo about Klingon, or pointing out that EBCDIC is still found in the wild.   Jon Hanna Jan 7 at 10:58
What's ugly about this one is, that GetString and GetBytes need to executed on a system with the same endianness to work. So you can't use this to get bytes you want to turn into a string elsewhere. So I have a hard time to come up with a situations where I'd want to use this.   CodesInChaos May 13 '12 at 11:14
@CodeInChaos: Like I said, the whole point of this is if you want to use it on the same kind of system, with the same set of functions. If not, then you shouldn't use it.   Mehrdad May 13 '12 at 18:00 
-1 I guarantee that someone (who doesn't understand bytes vs characters) is going to want to convert their string into a byte array, they will google it and read this answer, and they will do the wrong thing, because in almost all cases, the encoding IS relevant.   artbristol Jun 15 '12 at 11:07
@artbristol: If they can't be bothered to read the answer (or the other answers...), then I'm sorry, then there's no better way for me to communicate with them. I generally opt for answering the OP rather than trying to guess what others might do with my answer -- the OP has the right to know, and just because someone might abuse a knife doesn't mean we need to hide all knives in the world for ourselves. Though if you disagree that's fine too.   Mehrdad Jun 15 '12 at 14:04 
45	  	
This answer is wrong on so many levels but foremost because of it's decleration "you DON'T need to worry about encoding!". The 2 methods, GetBytes and GetString are superfluous in as much as they are merely re-implementations of what Encoding.Unicode.GetBytes() and Encoding.Unicode.GetString() already do. The statement "As long as your program (or other programs) don't try to interpret the bytes" is also fundamentally flawed as implicitly they mean the bytes should be interpreted as Unicode