C# return dynamic/anonymous type value as function result
2024-08-28 20:45:46
function:
public static dynamic GetAppSecret()
{
//string[] result = new string[] { "", "" };
dynamic result = new System.Dynamic.ExpandoObject(); result = new { appid="appid", appSecret = "appSecret" }; return result;
}
if you want to use the dynamic result function in a difference assembly, you should add following code to assemblyInfo.cs
[assembly: InternalsVisibleTo("WeChatSchools")]
invoke:
var secret = Helper.GetAppSecret();
app.t_appid = secret.appid;
app.t_appkey = secret.appSecret;
最新文章
- android 音乐播放器
- jenkins 入门教程(上)
- windows 常用命令
- Visual Studio 推荐插件--高量,变量高量,语法高亮
- SQLServer之数据类型
- (转)linux文件读写的流程
- [LeetCode]题解(python):091 Decode Ways
- 《Linux内核设计与实现》读书笔记(十二)- 内存管理【转】
- 控件如何在IDE中响应MouseDown事件
- Demo1_iOS9网络适配_改用更安全的HTTPS
- 不同版本PHP之间cURL的区别(-经验之谈)
- (转)实战p12文件转pem文件
- gulp使用2-gulp-less及watch和错误提示
- 兼容的Ajax
- MySQL基础操/下
- SpringBoot启动tomcat源码解读
- Maven解决包冲突
- [leetcode]2. Add Two Numbers.cpp
- [内核驱动] VS2012+WDK 8.0 Minifilter实现指定扩展名文件拒绝访问
- maven 下载jar失败: Missing artifact javax.jms:jms:jar:1.1