cannot convert from 'System.Guid?' to 'System.Guid'

前端 未结 4 1561
隐瞒了意图╮
隐瞒了意图╮ 2021-01-03 22:01

Does anyone know how to deal with this error?

cannot convert from \'System.Guid?\' to \'System.Guid\'
4条回答
  •  耶瑟儿~
    2021-01-03 22:42

    First intialize the guid variable.

    Guid yourGuid= Guid.NewGuid()
    

    then set value in that which you want for eg:

     Guid defaultId = Guid.NewGuid();
     if (customerRow.GuardianState.Length > 2) {
     Guid StateId = record.StateId ?? defaultId;}
    

提交回复
热议问题