Click here to Skip to main content
15,891,184 members
Home / Discussions / C#
   

C#

 
QuestionRe: Create Dynamic buttons Pin
CHill607-May-17 0:33
mveCHill607-May-17 0:33 
AnswerRe: Create Dynamic buttons Pin
User 41802547-May-17 8:49
User 41802547-May-17 8:49 
GeneralRe: Create Dynamic buttons Pin
Member 131834648-May-17 1:04
Member 131834648-May-17 1:04 
SuggestionRe: Create Dynamic buttons Pin
Richard Deeming8-May-17 1:54
mveRichard Deeming8-May-17 1:54 
QuestionHow to Do Implementation of this questions Please Pin
Member 131757266-May-17 11:08
Member 131757266-May-17 11:08 
AnswerRe: How to Do Implementation of this questions Please Pin
Mycroft Holmes6-May-17 14:00
professionalMycroft Holmes6-May-17 14:00 
AnswerRe: How to Do Implementation of this questions Please Pin
Pete O'Hanlon6-May-17 22:00
mvePete O'Hanlon6-May-17 22:00 
Questionanother way Type 'short is short-shrifted, but not short-shifted Pin
BillWoodruff5-May-17 1:10
professionalBillWoodruff5-May-17 1:10 
gentle reader: please recall this forum is also intended to be a C# language discussion forum. Yes, it may have evolved into a kind of parallel QA forum, but, I hope it is still a place for some exchanges around language features, and issues.

I'd guess most of us have noticed at some time there's no lexical qualifier for Types 'short or 'byte, like there are for 'long, 'double, etc. ... and wondered why ... even looked for a "why" ... perhaps come across Eric Lippert's standard why-no-feature rationale: "... because no one ever designed, implemented, tested and shipped that feature. More specifically: why should there be?"

Big-deal: you gotta cast, or specify Type, and these are compile-time operations:
C#
var brain = (short) 3;
short damage = 222;
However, today, while exploring 'BitVector32, I came across this:
> ? ((short)1) << 2
4
> ? ((short)1) << 2 is short
false
> ? ((short)1) << 2 is int
true
> ? ((long)1) << 2
4
> ? ((long)1) << 2 is long
true
> ? ((long)1) << 2 is int
false
>  ? ((uint)1) << 2
4
>  ? ((uint)1) << 2 is uint
true
>  ? ((uint)1) << 2 is int
false
>
I conclude bit-shifts cast a 'short to an 'int": ergo they are not short-shifted. Of course, I would never dare think the language designers were short-sighted !

fyi: the largest possible 'BitVector32.Section size is 0x7FFF (15 bits).
«When I consider my brief span of life, swallowed up in an eternity before and after, the little space I fill, and even can see, engulfed in the infinite immensity of spaces of which I am ignorant, and which know me not, I am frightened, and am astonished at being here rather than there; for there is no reason why here rather than there, now rather than then.» Blaise Pascal

AnswerRe: another way Type 'short is short-shrifted, but not short-shifted Pin
Jochen Arndt5-May-17 1:32
professionalJochen Arndt5-May-17 1:32 
AnswerRe: another way Type 'short is short-shrifted, but not short-shifted Pin
Pete O'Hanlon5-May-17 1:35
mvePete O'Hanlon5-May-17 1:35 
AnswerRe: another way Type 'short is short-shrifted, but not short-shifted Pin
harold aptroot5-May-17 3:05
harold aptroot5-May-17 3:05 
GeneralRe: another way Type 'short is short-shrifted, but not short-shifted Pin
BillWoodruff5-May-17 4:54
professionalBillWoodruff5-May-17 4:54 
GeneralRe: another way Type 'short is short-shrifted, but not short-shifted Pin
harold aptroot5-May-17 5:19
harold aptroot5-May-17 5:19 
GeneralRe: another way Type 'short is short-shrifted, but not short-shifted Pin
BillWoodruff5-May-17 7:44
professionalBillWoodruff5-May-17 7:44 
QuestionMessage Closed Pin
2-May-17 6:44
SHALCHAUHAN2-May-17 6:44 
AnswerRe: Regarding Website Pin
NotPolitcallyCorrect2-May-17 6:54
NotPolitcallyCorrect2-May-17 6:54 
AnswerRe: Regarding Website Pin
User 41802543-May-17 2:56
User 41802543-May-17 2:56 
QuestionLink DLL at runtime Pin
icristut2-May-17 1:36
icristut2-May-17 1:36 
AnswerRe: Link DLL at runtime Pin
Richard MacCutchan2-May-17 2:22
mveRichard MacCutchan2-May-17 2:22 
GeneralRe: Link DLL at runtime Pin
icristut2-May-17 2:29
icristut2-May-17 2:29 
GeneralRe: Link DLL at runtime Pin
Richard MacCutchan2-May-17 2:35
mveRichard MacCutchan2-May-17 2:35 
GeneralRe: Link DLL at runtime Pin
icristut2-May-17 4:29
icristut2-May-17 4:29 
GeneralRe: Link DLL at runtime Pin
Pete O'Hanlon2-May-17 4:38
mvePete O'Hanlon2-May-17 4:38 
GeneralRe: Link DLL at runtime Pin
icristut2-May-17 4:44
icristut2-May-17 4:44 
GeneralRe: Link DLL at runtime Pin
Dave Kreskowiak2-May-17 4:16
mveDave Kreskowiak2-May-17 4:16 

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.