.NET GUID大写字符串格式 [英] .NET GUID uppercase string format

查看:270
本文介绍了.NET GUID大写字符串格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要以虚线格式格式化我的GUID,全部大写。我知道使用 myGuid.ToString(D) String.Format({0:D},myGuid)给出了虚线格式,但使用大写 D 而不是小写 d 不给我像我想的那样大写的GUID。有没有办法做到这一点,而不做任何疯狂的,或者我只需要调用 myGuid.ToString()。ToUpper()



我只需要调用 myGuid.ToString()。ToUpper()


是的。你可以去创建一个自定义的IFormatProvider,但在这里看起来并不值得。


I need to format my GUIDs in the dashed format, all uppercase. I know using myGuid.ToString("D") or String.Format("{0:D}", myGuid) gives the dashed format, but using an uppercase D as opposed to a lower-case d doesn't give me an uppercased GUID like I thought it would. Is there a way to do this without doing anything crazy, or do I just need to call myGuid.ToString().ToUpper()?

解决方案

do I just need to call myGuid.ToString().ToUpper()

Yep. You could go to the effort of creating a custom IFormatProvider, but it doesn't seem worth it here.

这篇关于.NET GUID大写字符串格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆