Syntex:
condition ? con1 : con2
Examples:
string Name="fhsdfh hsjk dhfsjkahfsklfdhasklh shfkjsha sdfg sadgf sagsad";
string DisplayName = Name.Length > 50 ? Name.Substring(0, 50) + "..." : Name;
Output:
If Name character morethan 50 return -> fhsdfh hsjk dhfsjkahfsklfdhasklh...
Else -> Name
No comments:
Post a Comment