nullable Questions

1

I'm working on a codebase that is not yet <Nullable>enable</Nullable>. There is a vague notion that we will activate nullablity sometime soonish. While writing code I'm sometimes tempte...
Undirected asked 3/2, 2021 at 12:5

2

I want to ask if both are the same and if not, where's the difference between them: /** * @param int|null $id Any id. */ public function testSomething(int $id = null) {} and /** * @param int|nu...
Manor asked 23/9, 2020 at 8:54

2

Solved

I'm getting some unexpected results when using the nullable reference types feature with generics. For example, a generic class which has a nullable member public class Entry<T> where T : not...
Bubb asked 28/5 at 11:56

4

Solved

I'm trying to create a view where I want a column to be only true or false. However, it seems that no matter what I do, SQL Server (2008) believes my bit column can somehow be null. I have a table...
Lillian asked 24/2, 2010 at 14:47

7

I have solution with couple .NET Standard projects in all I wanted to enable c# 8 and nullable like below: <PropertyGroup> <TargetFramework>netstandard2.1</TargetFramework> <...
Epidemic asked 17/6, 2019 at 18:36

9

Solved

How do you check if a boolean is null or not? So if I know hideInNav is null. How do I stop it from further executing? Something like the below doesn't seem to work but why? boolean hideInNav = par...
Fennec asked 10/4, 2013 at 22:35

8

Solved

How to get short date for Get short date for System Nullable datetime (datetime ?) for ed 12/31/2013 12:00:00 --> only should return 12/31/2013. I don't see the ToShortDateString available.
Lactometer asked 24/9, 2013 at 12:59

6

Solved

I love that optionals are in the Java standard library now. But there is one basic problem that I keep running into that I haven't figured out how to solve in the best way (easiest to read and unde...
Decimalize asked 27/6, 2016 at 20:28

7

Solved

I get an xml from the 3rd party and I need to deserialize it into C# object. This xml may contain attributes with value of integer type or empty value: attr=”11” or attr=””. I want to deserialize t...
Grethel asked 18/8, 2009 at 18:35

3

As of 2023/JDK21, what @Nullable to use in Java? Many online materials don't even mention which import to use. So it is now (dark) history in what order those annotation appeared. I hope for gener...
Monophagous asked 6/7, 2023 at 15:33

11

Solved

There is paradox in the exception description: Nullable object must have a value (?!) This is the problem: I have a DateTimeExtended class, that has { DateTime? MyDataTime; int? otherdata; ...
Brenneman asked 13/12, 2009 at 11:8

9

Solved

I have an object of type Employee which has a Guid property. I know if I want to set to null I must to define my type property as nullable Nullable<Guid> prop or Guid? prop. But in my case I...
Clavicle asked 10/12, 2013 at 17:22

5

Solved

I'm currently using winforms databinding to wire up a data editing form. I'm using the netTiers framework through CodeSmith to generate my data objects. For database fields that allow nulls it crea...
Libretto asked 17/12, 2008 at 22:55

5

Solved

I'm responsible for a LINQ provider which performs some runtime evaluation of C# code. As an example: int? thing = null; accessor.Product.Where(p => p.anInt == thing.GetValueOrDefault(-1)) Cu...
Phototonus asked 14/4, 2015 at 11:38

14

Solved

I have an interface in TypeScript. interface Employee{ id: number; name: string; salary: number; } I would like to make salary as a nullable field (Like we can do in C#). Is this possible to ...
Tropopause asked 20/6, 2013 at 17:33

23

Solved

I'm wanting to parse a string into a nullable int in C#. ie. I want to get back either the int value of the string or null if it can't be parsed. I was kind of hoping that this would work int? va...
Fun asked 5/9, 2008 at 0:22

4

Solved

I was wondering if CsvHelper by Josh Close has anything in the configuration I am missing to translate values to null. I am a huge fan of this library, but I always thought there should be some sor...
Ileenileitis asked 11/9, 2013 at 6:8

4

Solved

Given Table 1 with one column "x" of type String. I want to create Table 2 with a column "y" that is an integer representation of the date strings given in "x". Essential is to keep null values in...

7

Solved

I have a method that has several overrides. In one of the more expanded overrides, I want to return an OUT parameter but not in my simpler overrides. For example: public bool IsPossible(string par...
Tay asked 30/6, 2011 at 18:34

2

Solved

I've been looking around other questions and I still don't understand what's going on here. I have this class: package com.test.service.database.converter; import com.test.service.database.dao.Doc...
Sower asked 18/5, 2022 at 8:33

3

Solved

In C# with nullable types it is possible to implement a 'TryGet' that is smart about null checking, e.g., bool TryGetById(int id, [NotNullWhen(returnValue: true)] out MyThing? myThing) which allow...
Displace asked 29/6, 2021 at 2:24

7

Solved

Optional type introduced in Java 8 is a new thing for many developers. Is a getter method returning Optional<Foo> type in place of the classic Foo a good practice? Assume that the value can ...
Panslavism asked 12/10, 2014 at 17:30

3

Solved

The where T : struct constraint lets one to limit the domain of acceptable type parameters to the set of value types (as compared to the superset of types including both value and reference types) ...
Heisler asked 26/3, 2017 at 2:27

3

Solved

I have this code #enable nullable public class SomeClass { public string SomeProperty { get; init; } } With the following compiler warning: [CS8618] Non-nullable property 'SomeProperty' must con...
Primrose asked 18/12, 2021 at 11:10

9

Solved

An int (Int32) has a memory footprint of 4 bytes. But what is the memory footprint of: int? i = null; and : int? i = 3; Is this in general or type dependent?
Sherri asked 4/9, 2009 at 20:8

© 2022 - 2024 — McMap. All rights reserved.