我的MVC项目中的Guid.newguid()错误 [英] Guid.newguid() error in my MVC project
本文介绍了我的MVC项目中的Guid.newguid()错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我在
Hello all,
i am having this error on the
basket.BasketId = Guid.NewGuid();
我得到以下intellisense说不能隐式转换类型system.Guid到int
basket.BasketId在我的类型为int模型,所以我想知道如何在模型中解决它的工作。谢谢
我尝试过:
i试图使用tryparse所有这一切,但它不起作用我也想知道我是否需要将它从模型转换为字符串。
and i get the the following intellisense saying "Cannot implicitly convert type system.Guid to int"
the basket.BasketId is having the type as int in my model so i want to know how i can fix that in the model for it to work. Thanks
What I have tried:
i have tried to use tryparse and all that but it not working i also want to know if i need to convert it to string from the model.
推荐答案
你不能将GUID转换为整数.NET的类型...
GUID是一个128位数字,大(内置)整数类型是64位...
You can not convert a GUID to an integer type of .NET...
A GUID is a 128 bit number and the larges (built-in) integer type is 64 bit...
这篇关于我的MVC项目中的Guid.newguid()错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文