Getting an error on line 'new Configuration().GetConfiguration' - c#

I'm currently trying out the code for "Create a Customer Payment Instrument" by using their sample code and I am getting an error on this line.
var configDictionary = new Configuration().GetConfiguration(); error is "The type or namespace 'Configuration' could not be found".
Quick fix shows me to add one of these two Using statements: using CyberSource.Client; or using CyberSource.Clients;.
But this gives me another error - 'Configuration' does not contain a definition for 'GetConfiguration' and no accessible extension method 'GetConfiguration' accepting a first argument of type 'Configuration' could not be found."
There isn't much documentation so I am unsure how to fix.

Related

CS1061: 'Bookmarks' does not contain a definition for 'Item'

I am trying to program a app for chain letters.
This is my Template: https://learn.microsoft.com/en-us/previous-versions/office/troubleshoot/office-developer/automate-word-create-file-using-visual-c
This is my code: https://github.com/440z/2021-07-01_WindowsFormsAppFuerKettenBriefMitWord
The error occurs in file Form1.cs in line 171.
Word._Document oDoc;
// ...
object oBookMark = "MyBookmark";
oDoc.Bookmarks.Item(ref oBookMark).Range.Text = "Some Text Here"; // L171
error CS1061: 'Bookmarks' does not contain a definition for 'Item' and no accessible extension method 'Item' accepting a first argument of type 'Bookmarks' could be found (are you missing a using directive or an assembly reference?)
I set a using directive and made a assembly reference how described in the template.
Add a reference to Microsoft Word Object Library. To do this, follow these steps:
On the Project menu, click Add Reference.
On the COM tab, locate Microsoft Word Object Library, and then click Select.
and
using Word = Microsoft.Office.Interop.Word;
using System.Reflection;
I just don't get it!!!
It looks like Bookmarks has an indexer, so: try one of
oDoc.Bookmark[ref oBookMark].Range.Text = "Some Text Here";
or
oDoc.Bookmark[oBookMark].Range.Text = "Some Text Here";
However, I would expect this to now complain that you're trying to access an invalid key, meaning: there is no existing bookmark keyed by "MyBookmark"

I have problem when i added New Scaffolded Item in razor page tutorial of doc.microsoft

I have problem when i added New Scaffolded Item in razor page tutorial of doc.microsoft
in tutorial pages.
Step 4 Complete the Add Razor Pages using Entity Framework (CRUD) dialog:
I have error message:
Finding the generator 'razorpage'...
Running the generator 'razorpage'...
Generating a new DbContext class 'RazorPagesMovie.Data.RazorPagesMovieContext' > Attempting to compile the application in memory with the added DbContext.
There was an error creating a DbContext :
(10,19): error CS1001: Identifier expected
(11,6): error CS1513: } expected
(12,44): error CS8124: Tuple must contain at least two elements.
(13,13): error CS1022: Type or namespace definition, or end-of-file expected
(13,27): error CS8124: Tuple must contain at least two elements.
(14,9): error CS1022: Type or namespace definition, or end-of-file expected
(18,5): error CS1022: Type or namespace definition, or end-of-file expected
(19,1): error CS1022: Type or namespace definition, or end-of-file expected > at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.<BuildCommandLine>b__6_0()M:\ASP\WebApp\RazorPagesMovie\RazorPagesMovie\Startup.cs
(30,13): error CS8389: Omitting the type argument is not allowed in the current
context
at
Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at
Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.Execute(String[] args)
at
Microsoft.VisualStudio.Web.CodeGeneration.CodeGenCommand.Execute(String[] args)
enter image description here

OpenTl c# IDialogs doesn't have an extension CS1061

I want to search all the telegram channels available with this :
var clientApi = await ClientFactory.BuildClientAsync(settings).ConfigureAwait(true);
IDialogs userDialogs = await clientApi.MessagesService.GetUserDialogsAsync(100).ConfigureAwait(true);
and then get the chats, so channels like this :
var s = userDialogs.Chats.AsEnumerable; //.Chats.asEnumerable();
but I can't compile it because it's throwing this error :
Error CS1061 'IDialogs' does not contain a definition for 'Chats' and no accessible extension method 'Chats' accepting a first argument of type 'IDialogs' was found (is a using directive or assembly reference missing?).
I'm using OpenTl and when I try to debug it, the userDialogs as an attribute Chats, as well as some others.
OpenTL library

In C#, I am getting an error when requesting permission for speech recognition Xamarin Android

So I am using the Plugin.SpeechRecognition Nuget Package and following the exact code on line and its not working.
I have tried adding the "Plugin.Permissions" Nuget Package and that hasn't helped and i have tried googling the problem but there isn't anyone getting this issue and it seems to work fine for everyone. I have also tried removing the "await" keyword and it just says
Operator '==' cannot be applied to operands of type 'IObservable' and 'bool'
Here is my code:
private async void GetSpeechPermission()
{
var granted = await CrossSpeechRecognition.Current.RequestPermission();
if (granted == true)
{
// go!
}
}
so what should happen is there is no error what so ever and the code should run fine but the line of code
await CrossSpeechRecognition.Current.RequestPermission();
has a red underline saying
IObservable' does not contain a definition for 'GetAwaiter' and no extension method 'GetAwaiter' accepting a first argument of type 'IObservable' could be found (are you missing a using directive or an assembly reference?)
when I am using the EXACT code provided by the creator of the plugin from here https://github.com/aritchie/speechrecognition
Any help is MUCH appreciated!!
The Solution to this was to add
using System.Reactive.Linq
in the using section of the code and instead of using a bool value as the code example for the plugin suggests, instead, in the if statement, convert the "granted" variable to a string and then check for "Available", Code:
private async void GetSpeechPermission()
{
var granted = await CrossSpeechRecognition.Current.RequestPermission();
if (granted.ToString() == "Available")
{
//GO
}
}
Hope this helps some one! :D

popping a stack out of a stack/queue

My question is about how to get a stack out of a queue. The program should work by generating stacks (shown below), having those stacks stuffed with data (also shown below), then unloading and displaying the data in them. Right now it just throws a CS1061 exception at me. The 5 is there for example, the actual code is picking a random string from an array.
public void newCustomers()
{
var customer = new Stack();
store.Enqueue(customer);
}
public void Shop()
{
var customer = store.Dequeue();
customer.Push(5);
//^currently this doesn't work. I'm assuming the typing for customer is wrong.
store.Enqueue(customer);
}
CS1061
Severity Code Description Project File Line Suppression State
Error CS1061 'object' does not contain a definition for 'Push' and no accessible extension method 'Push' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
You're using the non-generic Queue class. The Dequeue() method returns an object that you would have to cast to Stack:
var customer = (Stack)store.Dequeue();
customer.Push(5);
I would suggest using the generic queue class Queue<T> instead.

Categories

Resources