【c# – OneDrive api获取所有照片】教程文章相关的互联网学习教程文章

C# ——获取各国时间【代码】

DateTime dt = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now, TimeZoneInfo.Local); DateTime dt1 = TimeZoneInfo.ConvertTimeFromUtc(dt, TimeZoneInfo.FindSystemTimeZoneById("New Zealand Standard Time"));//参数对应国家或者时区 下面有相关国家和时区对应参数 MessageBox.Show("本地当前时间:" + DateTime.Now.ToString()+"\r\n"+ "UTC :" + dt.ToString() + "\r\n" + "新西兰当前:" + dt1.ToString());/* Dateline Stand...

C#关于获取硬盘号、CPU信息,加密解密技术【代码】

本篇内容来自https://blog.csdn.net/gisfarmer/article/details/3733153 在我们编写好一款软件后,我们不想别人盗用我们的软件,这时候我们可以采用注册的方式来保护我们的作品。这时候我们可能就需要简单了解一下加密解密技术,下面是我的简单总结:第一步:程序获得运行机的唯一标示(比如:网卡号,CPU编号,硬盘号等等)。第二步:程序将获得的唯一标示加密,然后有用户或者程序将加密后的标示发送给你。第三步:你将加密后的...

使用C#获取统计局行政区划代码【图】

在统计局官网提供了每年最新的PAC代码,方便大家查询,但没有提供完整版的下载,于是"手工"把它复制下来了。 http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/此工具有两个关键点: 1、Get函数中要注意编码问题,要去读取它是什么编码方式,否则可能是乱码;由于网速或服务器等原因,每一次请求时可以休眠100毫秒,每当出现404或服务器中断等情况时,线程暂停2秒再试(目前第二次Get都正常); 2、第二个关键点是年份、省、市、...

C#打开窗体获取文件夹

private void button5_Click(object sender, EventArgs e){FolderBrowserDialog dilog = new FolderBrowserDialog();dilog.Description = “请选择文件夹”;if (dilog.ShowDialog() == DialogResult.OK || dilog.ShowDialog() == DialogResult.Yes){textBox5.Text = dilog.SelectedPath;}}

C# 获取Newtonsoft.Json的JObject多层节点内容【代码】

json形如(企业微信审核接口返回结果){"errcode": 0,"errmsg": "ok. Warning: wrong json format. ","info": {"sp_no": "202011300016","sp_name": "请假","sp_status": 2,"template_id": "xxxxxxxxxxxxxxxxx","apply_time": 1606703944,"applyer": {"userid": "Z2019-018","partyid": "10"},"sp_record": [{"sp_status": 2,"approverattr": 1,"details": [{"approver": {"userid": "Z2019-509"},"speech": "","sp_status": 2,"sp...

C#高性能动态获取对象属性值【代码】【图】

动态获取对象的性能值,这个在开发过程中经常会遇到,这里我们探讨一下何如高性能的获取属性值。为了对比测试,我们定义一个类Peoplepublic class People {public string Name { get; set; } }?然后通过直接代码调用方式来取1千万次看要花多少时间:private static void Directly() {People people = new People { Name = "Wayne" };Stopwatch stopwatch = Stopwatch.StartNew();for (int i = 0; i < 10000000; i++){object value ...

c# 获取当前方法事件对应的控件【代码】

例如,comboBox1对应的事件SelectionChangeCommitted:private void comboBox1_SelectionChangeCommitted(object sender, EventArgs e) {...}我们想在方法内部获得事件方法对应的控件相关参数:名称、内容、数据... 可以通过SelectionChangeCommitted事件中传递过来的sender对象获取名称 因为我们的控件是comboBox类。所以用--->(ComboBox) sender, 同理,button类的就是--->(Button) sender ...((ComboBox) sender).Name//名称((...

C# winform在WebBrowser下获取完整的Cookies(包括含HTTPOnly属性的)【代码】

利用wininet获取网页Cookie 模拟post请求取数据,使用普通的Cookies无法获取完整的Cookies信息 只能获取了一部分 ,导致取回来的是重新登陆的页面。 后来经过不懈的精神,终于找到了方法实现获取HTTPOnly。 WinInet WinInet(“Windows Internet”)API帮助程序员使用三个常见的Internet协议,这三个协议是用于World Wide Web万维网的超文本传输协议(HTTP:Hypertext Transfer Protocol)、文件传输协议(FTP:File Transfer Prot...

C# 获取当前程序的命名空间、方法名、类名[转]

对当前运行程序,可用如下程序获取当前的命名空间、类名、方法名:1. // 0为本身的方法;1为调用方法 GetFrame(1) 2.// 方法名GetFrame(1).GetMethod().Name; 3. // 类名 GetFrame(1).GetMethod().ReflectedType.Name; public static string GetMethodInfo() {string str = "";//取得当前方法命名空间str += "命名空间名:" + System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Namespace + "\n";//取得当前方法类全...

C# .net aspx 前端获取session【代码】

正确解决方式 <asp:DropDownList ID="student_disucss_manage_drop_in" runat="server" DataSourceID="SqlDataSource2" Width="402px" OnSelectedIndexChanged="student_question_drop_SelectedIndexChanged" DataTextField="discuss_theme" DataValueField="discuss_theme"></asp:DropDownList><asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:my_systemConnectionString %>" Pr...

C# DataColumn 获取索引(非IndexOf)【图】

看到网上很多人说用indexOf其实这个方法是有问题的 比如 有两列 AB和A 你要获取A列的索引你怎么获取 在DataColumn中有一个设置列索引的方法叫 SetOrdinal , 故而获取索引就可以获取这个值即

C# 获取类、方法、属性的自定义特性(Attribute)信息【代码】【图】

首先定义一个自定义的属性类MyAttribute,该类需要继承Attribute public class MyAttribute : Attribute{/// <summary>/// 代码/// </summary>public string Code { get; set; }/// <summary>/// 描述/// </summary>public string Msg { get; set; }public MyAttribute() { }public MyAttribute(string code,string msg){this.Code = code;this.Msg = msg;}}接下来定义一个使用MyAttribute的类AttributeTest [MyAttribute("C...

(C#)获取变量的地址【代码】

c#变量分为值类型和引用类型,值类型空间分配在栈上,引用类型空间分配的堆上(引用值是在栈上);那么,如何获取变量的地址?using System; using System.Collections.Generic; using System.Text;namespace AddressOfVariable {class Program{class Point{public int x;public int y;}static void Main(string[] args){int number;//获取栈上变量的地址unsafe{int* p = &number;*p = 0xffff;Console.WriteLine("{0:x}", *p);Cons...

C#获取本地计算机证书信息

X509Store store = new X509Store(StoreName.Root, StoreLocation.LocalMachine);//获取本地计算机受信任的根证书的储存区public enum StoreNameAddressBook 1 其他用户的 X.509 证书存储区。AuthRoot 2 第三方证书颁发机构 (CA) 的 X.509 证书存储区。CertificateAuthority 3 中间证书颁发机构 (CA) 的 X.509 证书存储区。Disallowed 4 吊销的证书的 X.509 证书存储区。My 5 个人证书的 X.509 证书存储区。Root 6 受信...

C# 获取麦克风音量并设置音量,获取扬声器音量【代码】

//获取系统麦克风音量//private int GetCurrentSpeakerVolume()//{// int volume = 0;// var enumerator = new MMDeviceEnumerator();// //获取音频输出设备// IEnumerable<MMDevice> speakDevices = enumerator.EnumerateAudioEndPoints(DataFlow.Render, DeviceState.Active).ToArray();// if (speakDevices.Count() > 0)// {// MMDevice mMDevice = speakDevices.ToList()[0];// volume = Conv...