什么是使用IPAddress类的最佳方法 [英] What is best way to use the IPAddress Class
问题描述
我是使用.Net的新手我正在创建一个数据库来存储有关我公司监控系统的大量信息,包括IP地址。我希望能够根据输入验证1. IP地址是有效的,2。它是
不重复。有人可以提供一个如何做到这一点的样本吗?
谢谢
你可以使用IPAddress.ToString()方法转换为可以保存到数据库的标准表示法。
https://msdn.microsoft.com/en-us/library/system.net.ipaddress.tostring(v=vs.110)。 aspx
I am new to using.Net I am creating a database to store a substantial amount of information about my company's surveillance system including IP address. I want to be able to validate upon input that 1. the IP address is valid and 2. that it is not a duplicate. Can somebody provide a sample on how to do this?
Thank you
You can use IPAddress.ToString() method to convert to standard notation which you can save to database.
https://msdn.microsoft.com/en-us/library/system.net.ipaddress.tostring(v=vs.110).aspx
这篇关于什么是使用IPAddress类的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!