本文整理汇总了C#中System.Collections.Specialized.NameValueCollection.GetValues方法的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.Specialized.NameValueCollection.GetValues方法的具体用法?C# System.Collections.Specialized.NameValueCollection.GetValues怎么用?C# System.Collections.Specialized.NameValueCollection.GetValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Specialized.NameValueCollection
的用法示例。
在下文中一共展示了System.Collections.Specialized.NameValueCollection.GetValues方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Button_Click_image
/// <summary>
/// //图片media获取
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Button_Click_image(object sender, EventArgs e)
{
string a;
string b;
System.Collections.Specialized.NameValueCollection nc = new System.Collections.Specialized.NameValueCollection(Request.Form);
Response.Write(nc.GetValues("image")[0].ToString());
a = nc.GetValues("image")[0].ToString();
StreamWriter sw = new StreamWriter(@"E:\程序库\image_text.txt");
sw.WriteLine(a);
sw.Flush();
sw.Close();
StreamReader sr = new StreamReader(@"E:\程序库\access_token.txt");
b = sr.ReadLine();
sr.Close();
interfaceTest image_1 = new interfaceTest();
image_1.Uploadfile(a, b, "image");
}
示例2: Button_Click_MenuTextFunction
/// <summary>
/// 获取菜单功能内容填写模块的数据,然后调用后台方法生成XmlPage
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Button_Click_MenuTextFunction(object sender, EventArgs e)
{
string a;
System.Collections.Specialized.NameValueCollection na = new System.Collections.Specialized.NameValueCollection(Request.Form);
a = na.GetValues("FunctionComBox")[0].ToString();
string b;
System.Collections.Specialized.NameValueCollection nb = new System.Collections.Specialized.NameValueCollection(Request.Form);
b = nb.GetValues("FunctionUser")[0].ToString();
string c;
System.Collections.Specialized.NameValueCollection nc = new System.Collections.Specialized.NameValueCollection(Request.Form);
c = nc.GetValues("FunctionTextBox")[0].ToString();
AdministrateXml adxml = new AdministrateXml();
adxml.SetUpMenuTextFunctionXmlPage(a, b, c);
}
示例3: Encode
/// <summary>
/// Encodes an XML representation for a
/// <see cref="NameValueCollection" /> object.
/// </summary>
private static void Encode(NameValueCollection collection, XmlWriter writer)
{
if (collection == null) throw new ArgumentNullException("collection");
if (writer == null) throw new ArgumentNullException("writer");
if (collection.Count == 0)
return;
//
// Write out a named multi-value collection as follows
// (example here is the ServerVariables collection):
//
// <item name="HTTP_URL">
// <value string="/myapp/somewhere/page.aspx" />
// </item>
// <item name="QUERY_STRING">
// <value string="a=1&b=2" />
// </item>
// ...
//
foreach (string key in collection.Keys)
{
writer.WriteStartElement("item");
writer.WriteAttributeString("name", key);
var values = collection.GetValues(key);
if (values != null)
{
foreach (var value in values)
{
writer.WriteStartElement("value");
writer.WriteAttributeString("string", value);
writer.WriteEndElement();
}
}
writer.WriteEndElement();
}
}
示例4: Member
private static void Member(JsonTextWriter writer, string name, NameValueCollection collection)
{
Debug.Assert(writer != null);
Debug.AssertStringNotEmpty(name);
//
// Bail out early if the collection is null or empty.
//
if (collection == null || collection.Count == 0)
return;
//
// Save the depth, which we'll use to lazily emit the collection.
// That is, if we find that there is nothing useful in it, then
// we could simply avoid emitting anything.
//
var depth = writer.Depth;
//
// For each key, we get all associated values and loop through
// twice. The first time round, we count strings that are
// neither null nor empty. If none are found then the key is
// skipped. Otherwise, second time round, we encode
// strings that are neither null nor empty. If only such string
// exists for a key then it is written directly, otherwise
// multiple strings are naturally wrapped in an array.
//
var items = from i in Enumerable.Range(0, collection.Count)
let values = collection.GetValues(i)
where values != null && values.Length > 0
let some = // Neither null nor empty
from v in values
where !string.IsNullOrEmpty(v)
select v
let nom = some.Take(2).Count()
where nom > 0
select new
{
Key = collection.GetKey(i),
IsArray = nom > 1,
Values = some,
};
foreach (var item in items)
{
//
// There is at least one value so now we emit the key.
// Before doing that, we check if the collection member
// was ever started. If not, this would be a good time.
//
if (depth == writer.Depth)
{
writer.Member(name);
writer.Object();
}
writer.Member(item.Key ?? string.Empty);
if (item.IsArray)
writer.Array(); // Wrap multiples in an array
foreach (var value in item.Values)
writer.String(value);
if (item.IsArray)
writer.Pop(); // Close multiples array
}
//
// If we are deeper than when we began then the collection was
// started so we terminate it here.
//
if (writer.Depth > depth)
writer.Pop();
}
示例5: EngineCallback
/// <summary>
/// Launches a process by means of the debug engine. (http://msdn.microsoft.com/en-us/library/bb146223.aspx)
/// </summary>
/// <param name="pszServer"> The name of the machine in which to launch the process. Use a null value to specify the local
/// machine. Or it should be the name of the server? </param>
/// <param name="port"> The IDebugPort2 interface representing the port that the program will run in. </param>
/// <param name="exe"> The name of the executable to be launched. </param>
/// <param name="args"> The arguments to pass to the executable. May be a null value if there are no arguments. </param>
/// <param name="dir"> The name of the working directory used by the executable. May be a null value if no working directory is
/// required. </param>
/// <param name="env"> Environment block of NULL-terminated strings, followed by an additional NULL terminator. </param>
/// <param name="options"> The options for the executable. </param>
/// <param name="launchFlags"> Specifies the LAUNCH_FLAGS for a session. </param>
/// <param name="hStdInput"> Handle to an alternate input stream. May be 0 if redirection is not required. </param>
/// <param name="hStdOutput"> Handle to an alternate output stream. May be 0 if redirection is not required. </param>
/// <param name="hStdError"> Handle to an alternate error output stream. May be 0 if redirection is not required. </param>
/// <param name="ad7Callback"> The IDebugEventCallback2 object that receives debugger events. </param>
/// <param name="process"> Returns the resulting IDebugProcess2 object that represents the launched process. </param>
/// <returns> If successful, returns S_OK; otherwise, returns an error code. </returns>
int IDebugEngineLaunch2.LaunchSuspended(string pszServer, IDebugPort2 port, string exe, string args, string dir, string env, string options, enum_LAUNCH_FLAGS launchFlags, uint hStdInput, uint hStdOutput, uint hStdError, IDebugEventCallback2 ad7Callback, out IDebugProcess2 process)
{
Debug.Assert(m_programGUID == Guid.Empty);
process = null;
try
{
VSNDK.Package.ControlDebugEngine.isDebugEngineRunning = true;
m_engineCallback = new EngineCallback(this, ad7Callback);
// Read arguments back from the args string
var nvc = new NameValueCollection();
NameValueCollectionHelper.LoadFromString(nvc, args);
string pid = nvc.GetValues("pid")[0];
string exePath = exe;
string targetIP = nvc.GetValues("targetIP")[0];
bool isSimulator = Convert.ToBoolean(nvc.GetValues("isSimulator")[0]);
string toolsPath = nvc.GetValues("ToolsPath")[0];
string publicKeyPath = nvc.GetValues("PublicKeyPath")[0];
string password = null;
string[] passwordArray = nvc.GetValues("Password");
if (passwordArray != null)
password = passwordArray[0];
if (GDBParser.LaunchProcess(pid, exePath, targetIP, isSimulator, toolsPath, publicKeyPath, password))
{
process = m_process = new AD7Process(this, port);
m_eventDispatcher = new EventDispatcher(this);
m_programGUID = m_process._processGUID;
m_module = new AD7Module();
// m_progNode = new AD7ProgramNode(m_process.PhysID, pid, exePath, new Guid(AD7Engine.Id));
m_progNode = new AD7ProgramNode(m_process._processGUID, pid, exePath, new Guid(AD7Engine.Id));
AddThreadsToProgram();
AD7EngineCreateEvent.Send(this);
return VSConstants.S_OK;
}
else
{
GDBParser.exitGDB();
VSNDK.Package.ControlDebugEngine.isDebugEngineRunning = false;
return VSConstants.E_FAIL;
}
}
catch (Exception e)
{
return EngineUtils.UnexpectedException(e);
}
}
示例6: Buttton_Click_AddUser
/// <summary>
/// 触发后向数据库提交新添加用户的数据
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Buttton_Click_AddUser(object sender, EventArgs e)
{
string a;
string b;
System.Collections.Specialized.NameValueCollection nc = new System.Collections.Specialized.NameValueCollection(Request.Form);
Response.Write(nc.GetValues("AddUser")[0].ToString());
Response.Write(nc.GetValues("User")[0].ToString());
a = nc.GetValues("AddUser")[0].ToString();
b = nc.GetValues("User")[0].ToString();
DB db = new DB();
db.AddUser(a, b);
}
示例7: Button_Click_text
/// <summary>
/// //获取网页数据,调用后台方法生成Xml数据包
/// //生成了“电子信息工程”按钮的回复Xml数据包
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Button_Click_text(object sender, EventArgs e)
{
string a;
System.Collections.Specialized.NameValueCollection nc = new System.Collections.Specialized.NameValueCollection(Request.Form);
a = nc.GetValues("text")[0].ToString();
//获取下拉菜单中的当前数据
string b;
System.Collections.Specialized.NameValueCollection nc_1 = new System.Collections.Specialized.NameValueCollection(Request.Form);
b = nc_1.GetValues("ComBox")[0].ToString();
interfaceTest Xml_text = new interfaceTest();
Xml_text.Establish_Xml(a, b);
}
示例8: Button_Click_SetUpTextMenu
/// <summary>
/// //获取ID=“MenuTextbox”中的值,调用后台方法生成Xml数据包
/// //生成“文本菜单”按钮的回复Xml数据包
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Button_Click_SetUpTextMenu(object sender, EventArgs e)
{
string a;
System.Collections.Specialized.NameValueCollection nc = new System.Collections.Specialized.NameValueCollection(Request.Form);
a = nc.GetValues("MenuTextbox")[0].ToString();
AdministrateXml adxml = new AdministrateXml();
adxml.SetUpAddTextMenuXmlPage(a);
}