shad0wk shad0wk - 3 months ago 11
C# Question

Why are these types required and can they be removed?

I am creating my own .NET Framework, which will have my own types, objects and etc.

My code is being compiled with

csc.exe
with the option
/nostdlib[-|+]
.

But when I attempt to compile the code these errors popup:

error CS0518: Predefined type 'System.Byte' is not defined or imported
error CS0518: Predefined type 'System.Int16' is not defined or imported
error CS0518: Predefined type 'System.Int32' is not defined or imported
error CS0518: Predefined type 'System.Int64' is not defined or imported
error CS0518: Predefined type 'System.Single' is not defined or imported
error CS0518: Predefined type 'System.Double' is not defined or imported
error CS0518: Predefined type 'System.Char' is not defined or imported
error CS0518: Predefined type 'System.Boolean' is not defined or imported
error CS0518: Predefined type 'System.SByte' is not defined or imported
error CS0518: Predefined type 'System.UInt16' is not defined or imported
error CS0518: Predefined type 'System.UInt32' is not defined or imported
error CS0518: Predefined type 'System.UInt64' is not defined or imported
error CS0518: Predefined type 'System.IntPtr' is not defined or imported
error CS0518: Predefined type 'System.UIntPtr' is not defined or imported
error CS0518: Predefined type 'System.String' is not defined or imported
error CS0518: Predefined type 'System.Delegate' is not defined or imported
error CS0518: Predefined type 'System.MulticastDelegate' is not defined or imported
error CS0518: Predefined type 'System.Array' is not defined or imported
error CS0518: Predefined type 'System.Exception' is not defined or imported
error CS0518: Predefined type 'System.ValueType' is not defined or imported
error CS0518: Predefined type 'System.ParamArrayAttribute' is not defined or imported
error CS0518: Predefined type 'System.RuntimeTypeHandle' is not defined or imported
error CS0518: Predefined type 'System.RuntimeFieldHandle' is not defined or imported
error CS0518: Predefined type 'System.IDisposable' is not defined or imported
error CS0518: Predefined type 'System.Void' is not defined or imported


Why do these have to be defined? I though that the option would allow the creation of only custom types without having to re-create the defined ones. Can I remove some of them, like
Int16
(
short
)?

Update: Do I have to write my own compiler?

Answer

The only option so far is to create internal blank classes.

internal struct Int16 { } // short
internal struct UInt16 { } // ushort