language-specifications

Questions about Structs

MSDN says that a class that would be 16 bytes or less would be better handled as a struct [citation]. Why is that? Does that mean that if a struct is over 16 bytes it's less efficient than a class or is it the same? How do you determine if your class is under 16 bytes? What restricts a struct from acting like a class? (besides disallowin...

Syntax (probably BNF) spec of VBA ?

Hi, I have to maintain a portion of Access 2003 VBA code, which is not my primary programming language, and while I'm pretty solid on doing regular stuff, I would still like to have a pure spec of the language syntax.. It just saves a lot of time compared to reading tons of stupid tutorials that tell me what a for loop is. Is there any...

Why don't statements that don't do anything throw an exception (or warn the developer)?

I've been bitten a couple of times by statements in VB.NET (not sure if this effect exists in C#) that appear to be self-referencing, but when they're executed, they don't actually do anything because they require a target and one isn't provided. For example: Dim MyString as string = "String to test" ' Neither of these lines do anythin...

C# 'dynamic' keyword... is it really a RESERVED keyword or just a identifier that means something special when used as type?

I have a C# 4.0 parser. It accepts 'dynamic' as a keyword as a type. My parser trips over statements found in working C# 3.0 programs of the form of: dynamic = <exp> ; So, it dynamic really a keyword? Or can it still be used as an arbitrary identifier name? (If so, why isn't 'int' treated the same way)? Is there a reference spec s...

XSD doesn't allow me to have unbounded inside all indicator

I'm trying to make unordered list of variables in var1 occurs twice and var2 occurs infinite times (Use case in my project is different). The element does not allow me to use maxOccurs. Is there any work around for what I'm trying to do? <?xml version="1.0" encoding="ISO-8859-1"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema...

Problem understanding C# type inference as described in the language specification

The C# language specification describes type inference in Section §7.5.2. There is a detail in it that I don’t understand. Consider the following case: // declaration void Method<T>(T obj, Func<string, T> func); // call Method("obj", s => (object) s); Both the Microsoft and Mono C# compilers correctly infer T = object, but my underst...

Question regarding implicit conversions in the C# language specification

Section 6.1 Implicit conversions defines an identity conversion thusly: An identity conversion converts from any type to the same type. This conversion exists such that an entity that already has a required type can be said to be convertible to that type. Now, what is the purpose of sentences such as these? (In §6.1.6 Implicit ...