r/badcode • • Nov 26 '19

c# String Strang String Strang

Post image
776 Upvotes

54 comments sorted by

View all comments

29

u/Flamme2 Nov 26 '19

C#? I don’t think boolean is a valid type in c#. I think it is in Java though

32

u/_Stego27 Nov 26 '19

the fact that the linter has underlined them probably means they are trying to use java types (String, boolean) in C# which uses (string, bool). This just adds to the horror

11

u/Joniator Nov 26 '19

But String would work in C#, even if it is discouraged to use it

9

u/_Stego27 Nov 26 '19

I think it needs an import though

11

u/Dalimyr codes in C#...poorly Nov 26 '19

Yup, but only because it's capitalised. It's System.String. If it had been string without a capital then it would have been perfectly fine even without System. or using System;

4

u/_Stego27 Nov 26 '19

Yeah, in this case they have used the Java String (does not need an import in java) but the c# linter is rejecting it because they have not imported System.