Readdy Write  
0,00 €
Your View Money
Views: Count
Self 20% 0
Your Content 60% 0

Users by Links 0
u1*(Content+Views) 10% 0
Follow-Follower 0
s2*(Income) 5% 0

Count
Followers 0
Login Register as User
c# ; null ;

Empty String if Null: System.NullReferenceException

29.12.2022 (👁1976)

Empty String if Null: System.NullReferenceException

Fehlermeldung:
System.NullReferenceException: 'Object reference not set to an instance of an object.'

In C#

//< correct >

string sText255 = datarow.TextContent;

if (sText255.Length > 255) { sText255 = sText255.Substring(0, 255); }

//</ correct >

 

 

Ein Bild, das Text enthält.

Automatisch generierte Beschreibung

 

Solution:

Empty String if null

In C#
string sText255 = datarow.TextContent??"";

 

 

Ein Bild, das Text, Screenshot, Monitor, mehrere enthält.

Automatisch generierte Beschreibung

 

 

 

React: Warning: Each child in a list should have a unique "key" prop.