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;

C# return dynamic/anonymous type value as function result的更多相关文章

  1. java.lang.IllegalArgumentException: No converter found for return value of type: class com.smart.result.Page

    今天学习了一下spring boot 中的mybatis,用mybatis来增删改查用户,获取用户,添加用户,修改用户,删除用户,修改用户,都是可以的,但是获取带分页的用户列表,一直抛出这个java. ...

  2. C++:Abstract class : invalid abstract return type for member function ‘virtual...’

    #include <iostream> #include <cmath> #include <sstream> using namespace std; class ...

  3. 无法将类型“System.Collections.Generic.List<anonymous type:string ClassID,string ClsssName>”隐式转换为“System.Collections.Generic.List<Ecology.Model.EnergyFlowGraph>”

    无法将类型“System.Collections.Generic.List<anonymous type:string ClassID,string ClsssName>”隐式转换为“Sy ...

  4. How to get the return value of the setTimeout inner function in js All In One

    How to get the return value of the setTimeout inner function in js All In One 在 js 中如何获取 setTimeout ...

  5. 解决springmvc报No converter found for return value of type: class java.util.ArrayList问题

    一.背景 最近闲来无事,想自己搭建一套Spring+SpringMVC+Mybatis+Mysql的环境(搭建步骤会在以后博客中给出),结果运行程序时,适用@ResponseBody注解进行返回Lis ...

  6. 解决java.lang.IllegalArgumentException: No converter found for return value of type: class java.util.ArrayList这个问题

    今天使用SSM框架,用@ResponseBody注解,出现了这个问题 java.lang.IllegalArgumentException: No converter found for return ...

  7. Error 1313: RETURN is only allowed in a FUNCTION SQL Statement

    1.错误描述 14:07:26 Apply changes to rand_string Error 1313: RETURN is only allowed in a FUNCTION SQL St ...

  8. 解决No converter found for return value of type: class java.util.ArrayList

    十一月 02, 2018 7:37:44 下午 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() f ...

  9. Idea中:No converter found for return value of type: class java.util.ArrayList:Json格式转换问题

    1.在搞SSM框架的时候,前端发送请求后,显示如下错误. @ResponseBody注解进行返回List<对象>的json数据时出现 nested exception is java.la ...

随机推荐

  1. Qt树形控件QTreeView使用1——节点的添加删除操作 复选框的设置

    QtreeView是ui中最常用的控件,Qt中QTreeWidget比QTreeView更简单,但没有QTreeView那么灵活(QTreeWidget封装的和MFC的CTreeCtrl很类似,没有m ...

  2. C# - 转换

    无论什么类型 它们存储的其实都是一系列的位 在将A类型转换为B类型时 如果能完整转换 那么系统会将两个操作数自动进行隐式转换 但也有可能因为A类型的存储位数比B类型的存储位数大 那么B类型可能就没有足 ...

  3. centos 6.3安装mono和monoDevelop过程

    Mono官方网站:http://www.mono-project.com MonoDevelop官方网站:http://monodevelop.com/ 注:整个安装过程最好在同一个终端下完成! 1. ...

  4. JAVA_基础面试题

    1.面向对象的特征有哪些方面   1.抽象:抽象就是忽略一个主题中与当前目标无关的那些方面,以便更充分地注意与当前目标有关的方面.抽象并不打算了解全部问题,而只是选择其中的一部分,暂时不用部分细节.抽 ...

  5. kali2.0如何安装中文输入法

    由于kali的更新源是国外网站,替换成国内的镜像站,具体操作如下: 打开终端输入 leafpad /etc/apt/sources.list   把下面的源粘贴进去,原有内容注释掉 #中科大源deb  ...

  6. pcap支持Python2.7.8解决办法

    pcap库只支持到python2.5. pip install pcap在python2.7.8找不到. 只需要将网盘的2个文件放到python安装目录下lib/site-package文件夹即可 链 ...

  7. 用 C# 如何判断数据库中是否存在一个值

    选定一个列,比如用户编号列 //欲插入的用户编号string ll_userID="xxxxxxxx"; //查询此编号是否存在SqlCommand mycmd = new Sql ...

  8. Android AsyncTask 初探

    因为在开发Android应用时必须遵守单线程模型的原则: Android UI操作并不是线程安全的并且这些操作必须在UI线程中执行.在单线程模型中始终要记住两条法则: 1. 不要阻塞UI线程 2. 确 ...

  9. static与get属性的作用

    一.Static 用于没有属性的类中,不用保存属性的值,例如 var user=new User(): user.Name="jack" 可以直接调用类中的方法,避免需要多次访问该 ...

  10. ios NSAssert趣谈

    Apple 官网介绍 NSAssert 的定义如下: #define NSAssert(condition, desc, ...) \ do { \ __PRAGMA_PUSH_NO_EXTRA_AR ...